Line of code instead of "ans"
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I begin by an example.
A = [2 4]; A(1)
I'd like to know if there's a setting in the Matlab Preferences which returns
A(1) = 2
instead of
ans = 2
I know that I can write something like
fprintf('A(1)', num2str(A(1)));
but it's long to do for every variables I want to display.
Thanks,
Martin
0 个评论
采纳的回答
Azzi Abdelmalek
2013-6-7
编辑:Azzi Abdelmalek
2013-6-7
f=@(x,s,ii) [s sprintf('(%d)=',ii) num2str(x(ii))]
disp(f(A,'A',2))
0 个评论
更多回答(2 个)
Shashank Prasanna
2013-6-7
Nothing I am aware of but you can terminate the code with a semicolon and then use the diary command to capture the commands.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!