hello i want to create a table by using the value i obtained from a for loop, how can i get it
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jason Tan Jia Sheng
le 26 Déc 2021
Commenté : Jason Tan Jia Sheng
le 26 Déc 2021
x=5
y=30
for z=[1 2 4 8]
a=x*y*z;
disp(a);
end
table
x y z
5 30 150
5 30 300
5 30 600
5 30 1200
0 commentaires
Réponse acceptée
VBBV
le 26 Déc 2021
x=5
y=30
I = 1
for z=[1 2 4 8]
a(I)=x*y*z;
xx(I) = x;yy(I) = y;
I = I+1;
end
iwant = table(xx.',yy.',a.','VariableNames',{'x','y','z'})
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!