assigning indices to matrices

James Sherman Jr. shermanj at umd.edu
Mon Jul 20 10:52:12 CDT 2009


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.


On Sun, Jul 19, 2009 at 1:08 PM, shruti sharma <dograshruti at yahoo.co.in>wrote:

>
> Dear all,
>      I want to assign an index (say n) to the matrix carrying the same "n"
> as variable. For this I have written program as a seperate function file,
> which I call as "U(n)".
>       My problem is that I want to run a loop over "n" say from 1 to 10 and
> multiply the matrices U(1) * U(2)......* U(n). But not able to run the loop.
> Please suggest me the wayout.
>      Thanks in advance
>
> Sincerely,
> Shruti
>
>
>      See the Web's breaking stories, chosen by people like you. Check out
> Yahoo! Buzz. http://in.buzz.yahoo.com/
>
>
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090720/7abd8420/attachment.html 


More information about the Help-octave mailing list