Effacer les filtres
Effacer les filtres

Matlab Output Format!

2 vues (au cours des 30 derniers jours)
dmfwlansejr
dmfwlansejr le 16 Mar 2021
Commenté : Stephen23 le 16 Mar 2021
>> a=1
a =
1
>>
How to convert following format?
>> a=1
a=1
>>
  1 commentaire
DGM
DGM le 16 Mar 2021
I don't know that you can get such a format. You can remove the empty lines by specifying
format compact
but trying to get it all on the same line is something else.

Connectez-vous pour commenter.

Réponses (1)

ANKUR KUMAR
ANKUR KUMAR le 16 Mar 2021
You cannot format the output, but you can use disp to print in that way:
a=1;
disp('a=1')
disp(sprintf('a=%d',a))
You can use either of the last two commands.
  1 commentaire
Stephen23
Stephen23 le 16 Mar 2021
Or calling fprintf directly:
a = 1;
fprintf('a=%d\n',a)
a=1

Connectez-vous pour commenter.

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by