str2num() not working on bigger arrays?
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, I tried the following, and it is not working:
>> whos Name Size Bytes Class Attributes
XYZasCHARarray 121704x24 5841792 char
>> conversionstep1=str2num(XYZasCHARarray)
conversionstep1 =
[]
>> whos Name Size Bytes Class Attributes
XYZasCHARarray 121704x24 5841792 char
conversionstep1 0x0 0 double
>>
If I proceed on a smaller array (74208x24 char) for testing of my code, this step works fine and produces me the resulting array (74208x3 double) correctly. I so far have no reason to assume that the syntax inside my big char array would be different from the syntax in the smaller char array. Both arrays are the output of my parser, and this parser so far worked without problems, and the input data comes from a huge public scientific database wherein all datafiles should be correctly formated. In a text editor also the big input files looks o.k. . But I finally cannot confirm the big char variable in MATLAB to indeed be o.k. , because the Workspace Variable Browser does not allow to see the content of that array, because it is so big.
Is there a limitation in the use of the str2num() function, or is it a bug? What can I do to get my data converted? Thanks for help!
0 件のコメント
回答 (2 件)
Walter Roberson
2014 年 2 月 2 日
You should be considering using str2double() instead of str2num(). str2num() requires that the strings be executed as commands.
Note: str2double() works on a char vector or a cell array of strings, but not on a char array.
str2double(cellstr(XYZasCHARarray))
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!