The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to remove variable number of rows in each column of a matrix
Replies: 6   Last Post: Nov 3, 2013 1:14 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 9,822
Registered: 7/26/08
Re: How to remove variable number of rows in each column of a matrix
Posted: Nov 2, 2013 8:37 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply wrote in message <>...
> Say I have a 1000x10 matrix. The top of the matrix contains noisy data that I want to cut out. From column one I'd like to remove 10 values, from column 2, 15 values, from column 3, 8 values etc. After each column is reduced, I will keep the next 500 entries. So the end matrix will be 500x10. Right now I am doing it one column at a time which I have to put back together. Very tedious.

% Dummy data for test
idxstart=[10 15 8 7 29 14 1 72 4 4]; % index of the start row for each column

[m n]=size(A);
B = A(bsxfun(@plus, (0:n-1)*m + idxstart, (0:499)'));

% Bruno

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.