From help-octave-request at bevo dot che dot wisc dot edu Mon Dec 22 21:53:24 2003 Subject: Re: next problem From: Quentin Spencer To: help-octave at bevo dot che dot wisc dot edu Date: Mon, 22 Dec 2003 21:53:01 -0600 Rich Drewes wrote: >On Mon, 22 Dec 2003, Przemek Klosowski wrote: > > > >>Can anyone explain to me why do I need the transpose, i.e. why, in >>Matlab, y(:,:,:,:)=[x, x, x, x] and y=[x, x, x, x] are different? >> >> > >I oversimplified my example problem. The real line I was having trouble >converting from Matlab looked more like this: > >octave:3> F=[1,2,3; 4,5,6; 7,8,9] >octave:4> g(:,:,1,1)=F >error: invalid number of indices (4) for indexed assignment >error: assignment failed, or no method for ` = matrix' >error: evaluating assignment expression near line 4, column 11 > >The problem seems to be that Octave can't deal with (for example) >assigning 2 dimensions of a 4 dimensional array. Matlab can, and of >course this idiom is all over the program I am trying to port. Can you >suggest a convenient way of dealing with the issue of assigning certain >dimensions of a higher-dimensional array? I can see elaborate ways of >working around this, but a conveniently similar idiom would make porting >much easier. > > As far as I can tell this isn't implemented yet. I ran into the same thing a couple of days ago, and sent a bug report to the bug-octave list. Actually, I found two bugs at the same time, because I also discovered that the statement a(:,:,1)=ones(1,1,2) crashes octave. Multidimensional array support has been added to octave only since 2.1.51, so bugs are still being worked out (all of the ones that affected my Matlab scripts are fixed in the CVS sources now). This may be fixed by the next release, so if you're not in a hurry, I'd say don't worry about rewriting your code yet. Quentin ------------------------------------------------------------- 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 -------------------------------------------------------------