I want to store variable result inside avector and call it at the end of function exeution
i write this code and have Index exceeds array bounds
N=10;
Mp=1;
for i=1 : N
M2 =[Mp(i)];
Mp=Mp+1;
end

 Akzeptierte Antwort

KSSV
KSSV am 4 Feb. 2021

1 Stimme

N=10;
M2 = zeros(N,1) ;
Mp=1;
for i=1 : N
M2(i) = Mp;
Mp=Mp+1;
end

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018a

Gefragt:

am 4 Feb. 2021

Beantwortet:

am 4 Feb. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by