Search All of the Math Forum:

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

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

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 bijan.mobasseri@gmail.com Posts: 39 Registered: 7/19/05
Re: How to remove variable number of rows in each column of a matrix
Posted: Nov 3, 2013 1:14 AM
 Plain Text Reply

On Saturday, November 2, 2013 8:37:09 AM UTC-4, Bruno Luong wrote:
> bijan.mobasseri@gmail.com wrote in message <211f42c1-8ebc-4716-bf45-35fd3cbb0e18@googlegroups.com>...
>

> > 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
>
> A=rand(1000,10);
>
> 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

Bruno,

I have no idea what you are doing but it works! In case some may wonder where the application is, each column is a signal tract where the lead values are noise and need to be cut out. The problem is that the lead in segment has variable length, hence the question.

Date Subject Author
11/1/13 bijan.mobasseri@gmail.com
11/1/13 dpb
11/1/13 bijan.mobasseri@gmail.com
11/2/13 dpb
11/2/13 dpb
11/2/13 Bruno Luong
11/3/13 bijan.mobasseri@gmail.com

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