How can i increase the variabile name of each vector in for cycle? I want CM0_0, CM0_1, CM0_2...

조회 수: 2 (최근 30일)
for i=2:1:12
j=i-2;
if j==10;
CM1=inviscido(i,:);
else
CM0_j=inviscido(i,:); %this
end
end

채택된 답변

Jan
Jan 2019년 2월 15일
편집: Jan 2019년 2월 15일
Don't do this. Do not hide an index in the name of a variable. Use an array instead, e.g.:
CM0{1}, CM0{2}, CM0{3}
See this famous thread: TUTORIAL: How and why to avoid Eval

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by