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

 Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 13 Juin 2023
Modifié(e) : Dyuman Joshi le 13 Juin 2023
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 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Centre d'aide et File Exchange

Produits

Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by