How do I prevent my code from printing the ans statements?
1 view (last 30 days)
Show older comments
for k=2,3,4,5
X = randi([0,1],[k,4])
end
0 Comments
Accepted Answer
DGM
on 28 Jan 2022
% this is equivalent to what you wrote
for k = 2 % these are all individual statements
3
4
5
X = randi([0,1],[k,4])
end
for k = [2,3,4,5] % this is one statement
X = randi([0,1],[k,4])
end
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!