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 apply a function to the columns of a matrix
Replies: 9   Last Post: Dec 25, 2011 2:10 PM

 Messages: [ Previous | Next ]
 andalibar@gmail.com Posts: 17 Registered: 2/28/07
Re: How to apply a function to the columns of a matrix
Posted: Dec 24, 2011 4:08 PM

On Dec 24, 6:52 am, "Matt J " <mattjacREM...@THISieee.spam> wrote:
> Aseman <andali...@gmail.com> wrote in message <12529720-73f9-471f-99dc-e64e452f7...@b20g2000pro.googlegroups.com>...
> > On Dec 24, 1:24 am, "Matt J " <mattjacREM...@THISieee.spam> wrote:
> > > > hi
>
> > > > I should apply my own function fun to the columns of a matrix
> > > > A(200,000 by 1000). How to do this without cellfun or for loops?
> > > > any help will be greatly appreciated.

>
> > > ===============
>
> > > What's the function?
>
> > Dear Matt
> > This is actually the problem my colleague, Rahill, seek advice about
> > it. You kindly answered to his question in her past post. Your code
> > works more faster on each column of the matrix consisting of 180,000
> > elements, but how we could run it over all 744 columns without any for
> > loop?

>
> ==============
>
> I don't really understand what you mean by "your code works faster on each column". The code that I gave is not isolated to a particular column, nor does it contain any for-loops. It generated the entire A_segmented matrix in a single command. The only homework exercise that I left is to generalize the command to larger matrix sizes.

Dear Matt
I am so sorry that I was not clear enough. The matrix A, in my example
is the reshaped form of just one column of a primary matrix, say X,
which includes 744 columns. Thanks to the code you provided, we can
now do the job without reshaping each column. But, in the second step,
we should apply the code to the entire X column by column. please let
me note that we finally should apply a FFT function to the columns of
X.

Date Subject Author
12/24/11 andalibar@gmail.com
12/24/11 Matt J
12/24/11 andalibar@gmail.com
12/24/11 Matt J
12/24/11 andalibar@gmail.com
12/25/11 Matt J
12/25/11 Matt J
12/25/11 andalibar@gmail.com
12/24/11 Matt J
12/24/11 Nasser Abbasi