Option to turn off variable type display
7 次查看(过去 30 天)
显示 更早的评论
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
2020-11-11
Add a semicolon to the end of your line, because you know what is C and what's in C.
采纳的回答
Walter Roberson
2020-11-11
C = {4,ones(2);randi(3,3,2),randi(3)};
disp(C)
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 个评论
Walter Roberson
2020-11-12
Or
C = {4,ones(2);randi(3,3,2),randi(3)};
display(C)
ntdisp(C)
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 Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!