Create loop with variable pitch

1 Ansicht (letzte 30 Tage)
Alejandro Fernández
Alejandro Fernández am 4 Dez. 2019
Hello very good, I wondered if anyone would know how to create a for loop with variable pitch, the idea is as follows:
I would have to go through the positions 1 3 5 5.5 6 6.5 7 9. what I know is to use two bubles
for i=1:2:9
...
end
for i=5.1:0.5:6.9
...
end
Would there be any way to do it in one loop? Thank you very much.

Antworten (1)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH am 4 Dez. 2019
Bearbeitet: JESUS DAVID ARIZA ROYETH am 4 Dez. 2019
for i=[1 3 5 5.5 6 6.5 7 9]
...
end
  2 Kommentare
Alejandro Fernández
Alejandro Fernández am 4 Dez. 2019
thank you very much, but well the interval I had set is just an example, the real is much greater and write it by hand would not be a good solution.
Any other ideas?
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH am 4 Dez. 2019
What is the pattern that your data follows because if they do not follow a regular pattern you must place them manually, if they have a regular pattern then what would it be?

Melden Sie sich an, um zu kommentieren.

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