help-octave
[Top][All Lists]
Advanced

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

Re: Help please in interpreting Matlab code


From: Ben Abbott
Subject: Re: Help please in interpreting Matlab code
Date: Sat, 16 Apr 2011 20:06:12 -0400

On Apr 16, 2011, at 7:56 PM, Terry Duell wrote:

> Hullo All,
> I am trying to get some code written for Matlab, v7.3 I think, running in 
> Octave 3.2.4, but have had trouble finding any info to help me interpret the 
> code that Octave flags as a parse error.
> The code is as follows (there are 4 lines of text);
> 
>         imedges2c1(:,4*i-3:4*i) = 
> [cross(imcorners2c1(:,1),imcorners2c1(:,4)), ... = [ y4-y1 ; x1-x4 ; 
> x4*y1-x1*y4 ]
>                                                   
> cross(imcorners2c1(:,2),imcorners2c1(:,1)), ...
>                                                       
> cross(imcorners2c1(:,3),imcorners2c1(:,2)), ...
>                                                       
> cross(imcorners2c1(:,4),imcorners2c1(:,3))];
> 
> 
> Octave flags the error as;
> 
> 
>  syntax error
> 
>>>>         imedges2c1(:,4*i-3:4*i) = 
>>>> [cross(imcorners2c1(:,1),imcorners2c1(:,4)), ... = [ y4-y1 ; x1-x4 ; 
>>>> x4*y1-x1*y4 ]
>                                                                               
>      ^
> 
> Can someone please help me understand what this means and how to translate it 
> into code that is acceptable to Octave?
> 
> Cheers,
> -- 
> Regards,
> Terry Duell

That is bad syntax for Matlab too. I don't think the part below belongs there.

>>>> = [ y4-y1 ; x1-x4 ; x4*y1-x1*y4 ]

Matlab interprets everything after "..." as a comment. To run on Octave, try 
removing everything follow the ellipses, or just comment it out.

>         imedges2c1(:,4*i-3:4*i) = 
> [cross(imcorners2c1(:,1),imcorners2c1(:,4)), ... % = [ y4-y1 ; x1-x4 ; 
> x4*y1-x1*y4 ]
>                                                   
> cross(imcorners2c1(:,2),imcorners2c1(:,1)), ...
>                                                       
> cross(imcorners2c1(:,3),imcorners2c1(:,2)), ...
>                                                       
> cross(imcorners2c1(:,4),imcorners2c1(:,3))];

Ben



reply via email to

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