help-octave
[Top][All Lists]
Advanced

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

Re: any get() and assign() functionality (as in Splus)


From: Mirek Kwasniak
Subject: Re: any get() and assign() functionality (as in Splus)
Date: Wed, 24 Apr 2002 18:25:54 +0200
User-agent: Mutt/1.3.28i

On Wed, Apr 24, 2002 at 03:27:37PM +0000, Stefan Jonsson wrote:
> I am trying to find a way to work around the fact that Octave does not 
> support 3D arrays
> 
> I have 60 squared matrices   of order 10. A01, A02, ... ,A60
> 
> in a for loop I want to get the jth A matrix.
> 
> Lets say I have a vector of all the names of all the A        matrices such:
> 
> Anames = [ "A01"; "A02" ; .... ; "A60']
> 
> and to expand on this quetion lets say I have the  Xnames vector as well
> Xnames = [ "x01"; "x02" ; .... ; "x60']
> 
> I have x0 defined as vector of size 10.
> 
> I want to create 60 x vectors that corresponds to the entries in Xnames. 
> x01, x02, ..... ,x60
> 
> 
> is there a way by any means to extract from the name vector the 
> corresponding Aj matrix. And similarly put the result from a calculation in 
> a x-vector that corresponds to the name found
> in Xnames(j)
> 
> 
> Example:
> 
> for j = 1:N  # where N can take a value from 1 to 60
> 
> Aj = get.matrixfrom.a.name.vector(Anames(j))
> 
> xj = Aj*x0
> 
> Assign xj to a vector who's name is = Xnames(j)
> 
> endfor

Hi, 

It is possible use of eval:

  for j = 1:N
    eval( [ Xnames(j,:), '=', Anames(j,:), '*x0;' ] );
  endfor
  
but I think it would be better rewrote your code to use linear
(one-dimensional) indexing scheme.

Mirek



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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