Clear Filters
Clear Filters

For loop that takes element from certain locations in vector and creating a new one using picked out elements, please!

1 view (last 30 days)
Hi,
I need help with this:
For loop that takes element from certain locations in vector h, and creating a new one, H using those picked out elements?
I have a vector column vector h containing 25001 elements and want to pick out element that are in position 1001, 2001, 3001, 4001 and so on. How can i do that in a for or any other tool?
Best regards,
Daniel
  1 Comment
Daniel
Daniel on 7 Sep 2016
Instead of doing it like this:
T=[T(0001) T(1001) T(2001) T(3001) T(4001) T(5001) T(6001) T(7001) T(8001) T(9001) T(10001) T(11001) T(12001) T(13001) T(14001) T(15001) T(16001) T(17001) T(18001) T(19001) T(20001) T(21001) T(22001) T(23001) T(24001) T(25001) ];

Sign in to comment.

Answers (1)

José-Luis
José-Luis on 6 Sep 2016
Please read this. You don't need a loop.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!