Problem with the cycle

7 Ansichten (letzte 30 Tage)
Tiago Tavares
Tiago Tavares am 19 Jul. 2018
Beantwortet: jonas am 19 Jul. 2018
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 Kommentare
Tiago Tavares
Tiago Tavares am 19 Jul. 2018
If you are a football fan: Jonas scores!
If not, thank you very much! It worked!
jonas
jonas am 19 Jul. 2018
Bearbeitet: jonas am 19 Jul. 2018
Okay, I'm just gonna put it in an answer. Figured I had misunderstood the question :)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

jonas
jonas am 19 Jul. 2018
Center=B(1:10:end)

Weitere Antworten (0)

Kategorien

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by