Getting error message ' Index in position 1 exceeds array bounds ( must not exceed 4), error in line 7.
1 次查看(过去 30 天)
显示 更早的评论
A= 5*5 size matrix
for m=1:5;
for n=1:5;
line 7-> E= A(m,n);
disp (E).
0 个评论
采纳的回答
Awais Saeed
2021-8-21
You are storing only one element in E. Perhaps you want to copy elements of A into E element by element.
A = magic(5)
for m=1:1:size(A,1)
for n=1:1:size(A,2)
E(m,n)= A(m,n);
end
end
disp(E)
2 个评论
Awais Saeed
2021-8-21
A = magic(5)
for m=1:1:size(A,1)
for n=1:1:size(A,2)
E= A(m,n);
disp(E)
end
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!