Reputation: 45
I have 2 questions.
Question 1:
I have a column vector, v
, with (say) 1000 rows. I want to delete first (say) n
rows (for example n=300
to remove the first 300 rows of v
).
Question 2:
I have an array of indices. How can it be used to get rows of another array whose index values are in first array?
I = [ 1 2 4 5] %// array of indices
Q = [ 45 22 66 87 99 10 ] %// input array
Desired Output:
O = [45 22 87 99] %// output array
Upvotes: 0
Views: 1786
Reputation: 8459
For you first question:
N=300;
v=rand(1000,1); %// sample data
v(1:N)=[];
And the second:
O=Q(I)
Upvotes: 2