in command window while displaying a cell, instead of showing arrays , shows how many characters there are
Mostra commenti meno recenti
in command window while displaying a cell, instead of showing arrays , shows how many characters there are in that array. for example:
RESULT =
'r-t ' 'had'
' KOR' [1x84 char]
'hgfhf' [1x84 char]
'1iopio' [1x80 char]
that shows how many characters there are in RESULT{2,2} and RESULT{3,2} and RESULT{4,2}
5 Commenti
Fangjun Jiang
il 18 Set 2011
What is your question? For short strings, it shows the string itself. For long strings, you can imaging that the screen is not enough to show all of them, so it just tells you the length. I am not sure what is the threshold. You can certainly find out if you are interested.
mohammad
il 18 Set 2011
Fangjun Jiang
il 18 Set 2011
use celldisp(RESULT)
mohammad
il 18 Set 2011
Fangjun Jiang
il 18 Set 2011
I guess I don't really understand what you really want based on your question and all your comments.
To display a cell with long string, use disp(RESULT{3,2})
Or you can do: open('RESULT') will bring up the workspace editor.
Risposte (3)
Wayne King
il 18 Set 2011
Hi Mohammad, I'm not sure I understand exactly what you mean here, so I apologize if I am not getting your intent, but perhaps you mean:
C = {'had','KOR', 'hgfhf','1iopio'};
cellfun(@length,C,'UniformOutput',false)
cellfun(@class,C,'UniformOutput',false)
You can easily combine the length and class queries into a single cellfun() call.
Wayne
Wayne King
il 18 Set 2011
Hi Mohammad, Hard for me to debug without your splot() because I'm not sure what you are trying to do, but do any of these suggestions help:
One thing you can do if you really want to store the result in a cell array is:
RESULT{2,2}=sprintf('<matlab: splot(%s,%s) Not>',lab,dfi);
RESULT{2,2}
% or
fprintf('<matlab: splot(%s,%s) Not>\n',lab,dfi);
Walter Roberson
il 18 Set 2011
0 voti
This is not a bug; this is how MATLAB designed cell arrays to display on the screen. The same thing happens to numeric vectors and arrays: small ones are displayed directly and anything larger just displays the size and data type.
There is no option to modify this behavior.
Your best option is to write your own display routine that shows your data in the format you want.
3 Commenti
mohammad
il 18 Set 2011
Oleg Komarov
il 18 Set 2011
You can write a function which takes an input and displays it to the cmd widnow through fprintf.
mohammad
il 18 Set 2011
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!