hello every one
I want to display results that I obtained
like this:
disp('N= '; N)
but it doesn't work

 Akzeptierte Antwort

Dyuman Joshi
Dyuman Joshi am 13 Jun. 2023
Bearbeitet: Dyuman Joshi am 13 Jun. 2023

0 Stimmen

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 Kommentare

fprintf('N=%d\n', N)
% ^^ probably with a newline afterwards
Mira le
Mira le am 13 Jun. 2023
Thank you so much it works

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017a

Gefragt:

am 13 Jun. 2023

Kommentiert:

am 13 Jun. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by