use a loop structure .

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

Risposte (1)

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

Questa domanda è chiusa.

Richiesto:

il 29 Ago 2016

Chiuso:

il 20 Ago 2021

Community Treasure Hunt

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

Start Hunting!

Translated by