Problem with the cycle

조회 수: 7 (최근 30일)
Tiago Tavares
Tiago Tavares 2018년 7월 19일
답변: jonas 2018년 7월 19일
Hello. It's a relative simples question but im having problem with the next cycle:
for n=1:length(B)
for h=1:10
Center(n)= B(h);
end
end
I want to read a cell array B() that has an increment of 10 and save the value in the Center cell array.
Example: for Center(1) = B(1) and for Center(2)= B(10).
What is happening is that the B(h) only see the value of B(10) and fill the Center cell only with that value. Prior to the code presented i have a cell array B that is 1x1351. What am i missing?
  댓글 수: 3
Tiago Tavares
Tiago Tavares 2018년 7월 19일
If you are a football fan: Jonas scores!
If not, thank you very much! It worked!
jonas
jonas 2018년 7월 19일
편집: jonas 2018년 7월 19일
Okay, I'm just gonna put it in an answer. Figured I had misunderstood the question :)

댓글을 달려면 로그인하십시오.

채택된 답변

jonas
jonas 2018년 7월 19일
Center=B(1:10:end)

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by