How to dispaly result value?

2 次查看(过去 30 天)
hello every one
I want to display results that I obtained
like this:
disp('N= '; N)
but it doesn't work

采纳的回答

Dyuman Joshi
Dyuman Joshi 2023-6-13
编辑:Dyuman Joshi 2023-6-13
Use sprintf with disp
N=5;
%Create text
str = sprintf('N=%d', N); %d is the modifier for signed integer
%see the links attached for more info
%Display
disp(str)
N=5
or use fprintf
%Directly displays or prints the text input
fprintf('N=%d', N)
N=5
  2 个评论
Stephen23
Stephen23 2023-6-13
fprintf('N=%d\n', N)
% ^^ probably with a newline afterwards
Mira le
Mira le 2023-6-13
Thank you so much it works

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by