필터 지우기
필터 지우기

hi , I've got code shows more than the result because of the Loop . The question now is how do I store the result in array ​​in order to call this values [a] again

조회 수: 1 (최근 30일)
n=[4;5;6]; phi=[3;4;5]; s=[2;3;4]; o=3; for nn=1:o for ph=1:o for ss=1:o n(nn) phi(ph) s(ss) a=n(nn)+phi(ph)+s(ss) end end end

채택된 답변

Moe_2015
Moe_2015 2016년 8월 9일
Do you just want all the values of "a" stored in a 1D array? If so you can do this:
n=[4;5;6]; phi=[3;4;5]; s=[2;3;4]; o=3;
index = 0;
for nn=1:o
for ph=1:o
for ss=1:o
index = index+1;
a(index)=n(nn)+phi(ph)+s(ss);
end
end
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by