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;

Answers (1)

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 Comments

Leo
Leo on 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

Sign in to comment.

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Tags

Asked:

Leo
on 22 Oct 2013

Commented:

on 22 Oct 2013

Community Treasure Hunt

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

Start Hunting!