Matrix produces 12 times
Show older comments
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)
Walter Roberson
on 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 Comments
Leo
on 22 Oct 2013
Youssef Khmou
on 22 Oct 2013
for i = 1:4
for j = 1:3
A(i,j) = (50*i/(2077*273*j));
end
end
A
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!