在matlab中加倍

时间:2014-07-31 19:46:33

标签: matlab char cell

我有一个变量,比如x,包含 chars ,如下所示:

123123213
343423434
454545455
....

如果我这样做:

x(1) = 1 
x(1,1:9) = 123123213

我希望能够在写作时得到:

x(1)=123123213 

我尝试过:

s=[cellstr(x)];
t=[str2double(s)];

然后我得到了" t"类似的东西:

ans =

1.0e+020 *

   1.1352
   1.1006
   1.0835
   ....

图片解释:

http://i60.tinypic.com/2vv8jo6.png
http://i60.tinypic.com/2dbs3t3.png

如果它有助于我使用 matlab 7.12

1 个答案:

答案 0 :(得分:2)

也许str2num:

x = ['123123123';'343423434';'454545455']

x_num = str2num(x);

x_num(1)

ans =

   123123123