Option to turn off variable type display

조회 수: 13 (최근 30일)
David Winthrop
David Winthrop 2020년 11월 11일
댓글: Walter Roberson 2020년 11월 12일
I would like to know how to get rid of the line that tells me what type of variable is. This wasn't there in earlier releases but is there in r2018a. This is very annoying and I'd like to remove it because I already know it is a cell array - I'm the one who made it!
How do I get rid of that part of the display?
>> C = {4,ones(2);randi(3,3,2),randi(3)}
C =
2×2 cell array
{[ 4]} {2×2 double}
{3×2 double} {[ 2]}
  댓글 수: 2
Mario Malic
Mario Malic 2020년 11월 11일
Add a semicolon to the end of your line, because you know what is C and what's in C.
David Winthrop
David Winthrop 2020년 11월 11일
Haha.

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

채택된 답변

Walter Roberson
Walter Roberson 2020년 11월 11일
C = {4,ones(2);randi(3,3,2),randi(3)};
disp(C)
{[ 4]} {2×2 double} {3×2 double} {[ 3]}
That is, the information is not shown if you use disp(). The information is added by display() which is the function that is invoked when you do not have a semi-colon after an expression.
As far as I know, there is no option to tell display() not to put the information in.
  댓글 수: 2
David Winthrop
David Winthrop 2020년 11월 11일
Ah. So it looks like I would have to overload display.
Walter Roberson
Walter Roberson 2020년 11월 12일
Or
C = {4,ones(2);randi(3,3,2),randi(3)};
display(C)
C = 2x2 cell array
{[ 4]} {2×2 double} {3×2 double} {[ 3]}
ntdisp(C)
C = {[ 4]} {2×2 double} {3×2 double} {[ 3]}
function ntdisp(C)
varname = inputname(1);
if isempty(varname); varname = 'ans'; end
fprintf('%s = \n', varname)
disp(C);
end
Sigh, it turns out the type is sometimes added by disp() instead of display(). For example for transfer functions, toolbox/control/ctrlmodels/@tf/display.m pretty-prints the transfer function without giving a type, but disp() of it displays the list of visible properties instead.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by