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

 채택된 답변

KSSV
KSSV 2021년 2월 4일

1 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2021년 2월 4일

답변:

2021년 2월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by