MATLAB 5.3 (R11) v. Octave 3.0.0 script compatibility error?

v4r4n console.cowboy at gmail.com
Thu Apr 23 15:28:00 CDT 2009


Your breakdown of what is supposed to happen is consistent with what I found
using MATLAB (R11).

Octave 3.0.5 doesn't appear to have made it into Ubuntu 9.04 and I wasn't
able to find any 3.0.x Debian packages to test against, so my confirmation
of where/when this bug was fixed will have to wait.

Thanks again for the prompt response.

On Thu, Apr 23, 2009 at 12:04 PM, John W. Eaton <jwe at octave.org> wrote:

>  On 23-Apr-2009, v4r4n wrote:
>
> | After finally getting some MATLAB scripts from an old thesis to work with
> a
> | MATLAB (R11) on WinXP, I decided to try and see if the same scripts
> worked
> | with Octave.
> |
> | Using Ubuntu 8.04 and Octave 3.0.0 these commands:
> |
> | VEC = [1, 2, 3];
> | for i=VEC
> | DB(i==VEC)=-15;
> | end
> |
> | produce these error messages:
> |
> | error: invalid index = 0
> | error: assignment failed, or no method for `scalar = scalar'
> | error: evaluating assignment expression near line 3, column 15
> | error: evaluating for command near line 2, column 1
> |
> | Please forgive me if this is a known bug/error.  Since I'm new to both
> | MATLAB and Octave, I'm unsure how to search for and describe what is
> going
> | on here.
> |
> | If this is the wrong place to post and ask such questions, please point
> me
> | in the right direction.
>
> Octave 3.1.x does this:
>
>  octave3.1:1> VEC = [1, 2, 3];
>  octave3.1:2> for i=VEC
>  > DB(i==VEC)=-15;
>  > end
>  octave3.1:3> DB
>  DB =
>
>    -15  -15  -15
>
>
> The loop
>
>  for i = VEC
>
> assigns each column of VEC to i in turn.  The first time the loop body
> is executed, i is set to 1, and i == VEC produces the logical value
> [1, 0, 0], so you assign the first element of DB to -15.  The second
> time through the loop, i is set to 2 and i == VEC produces the logical
> value [0, 1, 0], so you assign the second element of DB to -15.  And
> so on.
>
> Is that what expect?
>
> So yes, there was a compatibilty problem in the older version of
> Octave, but I think that hsa been fixed for the next release.
>
> The problem also should be fixed in the current 3.0.x release (3.0.5).
>
> jwe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20090423/425600d7/attachment.html 


More information about the Bug-octave mailing list