how to print variables in command window with message

5 vues (au cours des 30 derniers jours)
Triveni
Triveni le 13 Déc 2015
A=[1, 3,4]
I want to print size of A is length(A) and A is print(A , length(A))
  1 commentaire
Triveni
Triveni le 13 Déc 2015
I also want to print message with variable.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Déc 2015
I had to make some guesses about exactly what you want output.
varname = 'A';
varlength = length(A);
fprintf('size of %s is %d\n', varname, varlength);
fprintf('%s is', varname);
fprintf(' %g', [A(:); varlength]);
fprintf('\n');

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by