Matrix produces 12 times

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
Walter Roberson le 22 Oct 2013

1 vote

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
Leo le 22 Oct 2013
Is there any way of displaying this in the command window only once?
for i = 1:4
for j = 1:3
A(i,j) = (50*i/(2077*273*j));
end
end
A

Connectez-vous pour commenter.

Catégories

En savoir plus sur Operators and Elementary Operations dans Centre d'aide et File Exchange

Tags

Question posée :

Leo
le 22 Oct 2013

Commenté :

le 22 Oct 2013

Community Treasure Hunt

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

Start Hunting!

Translated by