如何将字符串数字的单元格数组转换为数字向量

时间:2016-07-26 09:58:03

标签: arrays string matlab cell

我正在使用Matlab,我有以下数据:

a = {'3' '11' '7'}; % This is what I have.

我的目标是使用函数将此类单元转换为具有以下形状的向量:

b = [3 11 7]; % What I need to get!

如果我尝试使用b = cell2mat(a)函数,我得到的结果是这个数字:b = 3117;这不是我想要的。

我应该用什么功能来达到目标​​?如果可能的话,请不要使用for循环,而只使用Matlab函数。

1 个答案:

答案 0 :(得分:2)

您正在寻找str2double

<div id="contact_info">
                    <h3><a id="contact">Contact</a></h3>
                    <p>If you are interested in chatting or want more information on what I have been working on, I'd 
                        love to hear from you!</p>
                        <p><strong>Phone: 0064 1122334455</strong></p>
                        <p>Email: tracyexcell@email.com</p>
相关问题