MATLAB Answers

0

How to select every nth value with the last value fixed from a column?

Asked by Noor Yaseen on 21 Oct 2019
Latest activity Commented on by Noor Yaseen on 22 Oct 2019
I have a column of 4901 values starting from a value of -25 (at first position) to a value of 8579 (at 4901 th position). Now I want to have a new column that should comprise of values after every 100 th number BUT the last value ( i.e., 8579) should remain in the new column

  0 Comments

Sign in to comment.

2 Answers

Answer by Yuan Li
on 21 Oct 2019
 Accepted Answer

use
a = original_vector(1:100:4901);

  1 Comment

Thanks a lot Yuan Li, I got it.

Sign in to comment.


Answer by Andrei Bobrov
on 21 Oct 2019

a = original_vector([100:100:4901,4901]);

  1 Comment

This is commendable. Thank you Andrei Bobrov

Sign in to comment.