[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assigning matrices to structures and indexing
From: |
Tom Holroyd |
Subject: |
Re: Assigning matrices to structures and indexing |
Date: |
Fri, 27 May 2005 07:28:05 -0400 (EDT) |
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
-------------------------------------------------------------