in command window while displaying a cell, instead of showing arrays , shows how many characters there are

조회 수: 3 (최근 30일)
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
mohammad
mohammad 2011년 9월 18일
so nice
really very nice
is it possible to display in this form(for example): RESULT{RESULT{11,1},RESULT{1,3}} instead of RESULT{11,3}
RESULT{11,1} is the name of a reference in first column
RESULT{1,3} is the name of a input in first row
Fangjun Jiang
Fangjun Jiang 2011년 9월 18일
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.

댓글을 달려면 로그인하십시오.

답변 (3개)

Wayne King
Wayne King 2011년 9월 18일
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
  댓글 수: 2
mohammad
mohammad 2011년 9월 18일
Thanks for replying
for example
lab='dfgfdgdfgfdgfdgdfgdfg'
dfi='rtysghhjmdfhdfgyutrujy'
%splot is a function
RESULT{2,2}=sprintf('<a href="matlab: splot(%s,%s)">Not</a>',lab,dfi)
and in command window it must show RESULT{2,2}=Not in hyperlink
but it shows numbers of characters of RESULT{2,2} instead of 'Not' in hyperlink
mohammad
mohammad 2011년 9월 18일
And this will happen while using more character in a cell array but how can it be fix?

댓글을 달려면 로그인하십시오.


Wayne King
Wayne King 2011년 9월 18일
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
Walter Roberson 2011년 9월 18일
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
Oleg Komarov
Oleg Komarov 2011년 9월 18일
You can write a function which takes an input and displays it to the cmd widnow through fprintf.
mohammad
mohammad 2011년 9월 18일
@Oleg this characters are not long in command window but these are so long in array of it self. for example for under array:
RESULT{2,2}=sprintf('<a href="matlab: splot(%s,%s)">Not</a>',lab,dfi);
there are more than 100 character. but in command window it must show only 'Not' that is very short.
i must use 'sprintf' that as so as you see i used it in array RESULT{2,2}

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by