How to prevent it from showing [1x76 char]?
1 次查看(过去 30 天)
显示 更早的评论
Hi
I am doing a textread on a set of data, apparently when I look into the data at the command window. I notice there are strings that just show [1x76 char], does it mean that the matlab is unable to read data that are very long? Please enlighten, if I want to read the set of data. Thanks.
Example:
[1x76 char]
'$GPGSV,3,1,11,04,60,111,45,12,55,237,44,02,50,201,44,25,38,296,44*79' '$GPGSV,3,2,11,10,27,140,44,31,19,343,44,20,16,034,,23,14,058,*7C' '$GPGSV,3,3,11,17,13,110,43,29,07,277,,32,0.,013,*59'
[1x76 char]
'$GPGSV,3,1,11,04,60,111,45,12,55,237,44,02,50,201,44,25,38,296,44*79' '$GPGSV,3,2,11,10,27,140,44,31,19,343,44,20,16,034,,23,14,058,*7C' '$GPGSV,3,3,11,17,13,110,43,29,07,277,,32,0.,013,*59'
Regards, Casey
0 个评论
采纳的回答
Walter Roberson
2012-10-1
The data has been read fine, and this is just the way that it displays long strings that are inside cell arrays.
The only way to prevent it from doing that is to override the display() method and reprogram it to display things differently. There is no (documented) way to customize that behavior (other than overriding the low-level routine.)
If you want to see the entire string for one particular entry, use cell array access, such as data{1} to access row 1 of the cell array named "data".
You could also convert the entire cell array of strings into a blank-padded character array for display purposes by using char(data) for the cell array named "data"
0 个评论
更多回答(1 个)
Jan
2012-10-1
C = regexp(path, pathsep, 'split');
C
According to the current width of your command window, the output is abbreviated to something like "[1 x 76 char]". This should avoid ambiguities with strings starting with 76 spaces, such that the interesting part is displayed right from the visible section.
It is debatable, if this is a useful procedure. But you can avoid it easily:
fprintf('%s\n', C{:});
Now you see all strings without smart abbrevs.
0 个评论
另请参阅
类别
在 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!