str2num() not working on bigger arrays?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Walter Roberson
el 2 de Feb. de 2014
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))
1 comentario
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!