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 retrieve the given column of the data of arbitrary size?
Replies: 7   Last Post: Nov 18, 2012 6:14 PM

 Messages: [ Previous | Next ]
 Justin Ashmall Posts: 20 Registered: 8/16/12
Re: How to retrieve the given column of the data of arbitrary size?
Posted: Nov 12, 2012 7:37 AM

> For instance, A is a 10x10x10x10 matrix, the 3rd column of the 2nd dimension of A is given by squeeze(A(:,3,:,:)). What if the size of A is arbitrary? A could be 10x10, 5x10x5, 10x10x5x5x10, ..., or anything else. How to write a function applicable to arbitray A?

Take a look at the function subsref. You'll need to build an appropriate input structure (S) with the right number of colons. It shouldn't be difficult, just fiddly. The documentation will point you in the right direction.

Justin

Date Subject Author
11/12/12 Ha
11/12/12 Justin Ashmall
11/13/12 Ha
11/13/12 Bruno Luong
11/13/12 Jan Simon
11/14/12 Steven Lord
11/18/12 Paul
11/13/12 Ha