Matrix produces 12 times
Afficher commentaires plus anciens
I wrote a for function to create a 4 by 3 matrix. When I run it, I get the right matrix, but it copies 12 times. Why is this? What do I need to change?
for i = 1:4;
for j = 1:3;
A(i,j) = (50*i/(2077*273*j))
end;
end;
Réponses (1)
Walter Roberson
le 22 Oct 2013
Add a semi-colon after the assignment statement.
Note: that is the only place the semi-colon is meaningful in your code.
for i = 1:4
for j = 1:3
A(i,j) = (50*i/(2077*273*j));
end
end
2 commentaires
Leo
le 22 Oct 2013
Youssef Khmou
le 22 Oct 2013
for i = 1:4
for j = 1:3
A(i,j) = (50*i/(2077*273*j));
end
end
A
Catégories
En savoir plus sur Operators and Elementary Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!