How to prevent it from showing [1x76 char]?

8 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 1 Oct 2012
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"

More Answers (1)

Jan
Jan on 1 Oct 2012
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.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!