help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Arrays: Multidimensional manipulating


From: John W. Eaton
Subject: RE: Arrays: Multidimensional manipulating
Date: Tue, 12 Apr 2011 12:51:04 -0400

On 12-Apr-2011, William Krekeler wrote:

| Maybe you could try using meshgrid.
| 
| [A,B,K] = meshgrid(a,b,k);
| p = size(A);
| p = exp(-1.*A.*(abs(K)).^B);

What is the second line for?

Using meshgrid is good if you need exactly three dimensions.  If you
need more, then you will need something like the method I showed with
repmat and reshape.  But the basic idea is the same.  You need to
generate a set of matrices all with the same size that together
contain all the combinations that you are looking for.  Of course if
you need many dimensions, you will quickly run out of memory storing
the temporary matrices that represent all combinations...

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]