How to select consecutive values with the specified interval ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sneha Vasan
am 17 Sep. 2020
Kommentiert: Sneha Vasan
am 17 Sep. 2020
For example,
If I want to select [1,10,11,21,31,41], I use [1:10:50].
Now, I would like to select first three consecutive numbers with an added interval of 10 til 50. i.e [1,2,3,11,12,13,21,22,23,31,32,32,41,42,43]
How can I do this without using any loops,just as above case. Is there any way?
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 17 Sep. 2020
Bearbeitet: madhan ravi
am 17 Sep. 2020
reshape((1:10:50) + (0:2).', 1, [])
% reshape(bsxfun(@plus, 1:10:50, (0:2).'), 1, []) %%for older versions
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!