Info

此问题已关闭。 请重新打开它进行编辑或回答。

use a loop structure .

1 次查看(过去 30 天)
Aurelio Gonzalez
Aurelio Gonzalez 2016-8-29
关闭: MATLAB Answer Bot 2021-8-20
A=zeros(4) % this is the same as zeros (4,4) // returns as a 4x4 matrix of zeros
for m= 1:4
for n=1:4
A(m,n) = m*10+n
end
end

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2016-8-29
This can be done without a for loop
[m,n]=ndgrid(1:4);
A=m*10+n

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by