[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assigning matrices to structures and indexing
From: |
SITI HAJAR A BAKAR |
Subject: |
Re: Assigning matrices to structures and indexing |
Date: |
Wed, 01 Jun 2005 21:51:30 +1000 |
Thanks heaps , it worked! mY was that the sizes of the matrices I was
expecting as a result of ss2tf would not fit in the structure I wa
assigning them too, if that makes sense. I had to initally specify the
size of the structure for which the resultant matrices would fit in.
Thanks again!
Regards,
Siti HAjar BAkar
----- Original Message -----
From: Tom Holroyd <address@hidden>
Date: Friday, May 27, 2005 9:28 pm
Subject: Re: Assigning matrices to structures and indexing
> > I'm having trouble implementing the following
> > lines in Octave 2.1.70 in Windows). They work in MATLAB .
> >
> > [G.B(k,:,m),G.A(k,:,m)] =
> ss2tf(G.ss.A,G.ss.B,G.ss.C(m,:),G.ss.D(m,:),k);
> Or to put it more simply,
>
> octave:7> A(1,:,2) = 4
> A =
>
> ans(:,:,1) = 0
> ans(:,:,2) = 4
>
> octave:8> A(1,:,2) = [4,5]
> error: A(IDX-LIST) = X: X must be a scalar or size of X must
> equal number of elements indexed by IDX-LIST
> error: assignment failed, or no method for `matrix = matrix'
> error: evaluating assignment expression near line 8, column 10
>
> If you preallocate the array it'll work:
>
> octave:8> B = zeros(1,2,2);
> octave:9> B(1,:,2) = [4,5]
> B =
>
> ans(:,:,1) =
>
> 0 0
>
> ans(:,:,2) =
>
> 4 5
>
>
> Dr. Tom Holroyd
> "A man of genius makes no mistakes. His errors are volitional and
> are the portals of discovery." -- James Joyce
>
>
>
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
>
>
-------------------------------------------------------------
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
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Assigning matrices to structures and indexing,
SITI HAJAR A BAKAR <=