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

Advanced Search

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

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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Dec 24, 6:52 am, "Matt J " <mattjacREM...@THISieee.spam> wrote:
> Aseman <> wrote in message <>...
> > On Dec 24, 1:24 am, "Matt J " <mattjacREM...@THISieee.spam> wrote:
> > > Aseman <> wrote in message <>...
> > > > 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
Thanks for your comment.
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

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.