Effacer les filtres
Effacer les filtres

can i give variable different names then call this name

1 vue (au cours des 30 derniers jours)
Abdulaziz
Abdulaziz le 29 Nov 2012
hi guys
please I have question in displaying a name in matlab. I am using 5 cases each one has its won properties. after finishing the calculation I want to display the material name with the output data. is there any way to give a variable the name of material in every case so I can call it in the display or fprintf function.
Best regards

Réponse acceptée

Matt J
Matt J le 29 Nov 2012
Sure. You can even pass it several names, e.g.,
material={'lead','silver','gold'};
for ii=1:3, disp(material{ii}), end

Plus de réponses (2)

Azzi Abdelmalek
Azzi Abdelmalek le 29 Nov 2012
You can also generate names depending on your counter
for k=1:3
name{k}=sprintf('name%d',k)
end

Walter Roberson
Walter Roberson le 29 Nov 2012

Catégories

En savoir plus sur MATLAB 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