help-octave
[Top][All Lists]
Advanced

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

Re: assigning indices to matrices


From: Jaroslav Hajek
Subject: Re: assigning indices to matrices
Date: Tue, 21 Jul 2009 08:04:20 +0200

On Mon, Jul 20, 2009 at 5:52 PM, James Sherman Jr.<address@hidden> wrote:
> I'm not quite sure what you're trying to do here.  Is U a function that
> takes an integer as an input and returns a matrix?  I don't know if this is
> what you want to do, but if you have a collection of matrices of the same
> size, I'd store them in a 3 dimensional matrix like so:
>
> U(:, :, 1) = first_matrix;
> U(:, :, 2) = second_matrix;
>
> and so on, then to access them, you just need to do:
>
> fifth_matrix = squeeze(U(:, :, 5));
>
> though depending on what you need to do, squeeze might not be necessary.
>
> Hope this helps.
>

in your expression, squeeze is surely unnecessary. trailing singleton
dimensions are discarded automatically.


-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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