Error with Catch ME continue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error with Catch ME continue

Farzadtb
Hi All

I have a part of my Matlab code written with 

    catch ME
        warning('found error in %dth file', i);
        fprintf('Error: %s\n', ME.message);
        continue


but in Octave I get this error :

error: octave_base_value::int64_scalar_value(): wrong type argument 'complex scalar'
error: called from
    MyCode at line 414 column 9



--
SeyedFarzad Torabi
Master of Mech. Eng.
Politecnico Di Milano

Virus-free. www.avast.com


Reply | Threaded
Open this post in threaded view
|

Re: Error with Catch ME continue

mmuetzel
Am 23. Oktober 2019 um 08:38 Uhr schrieb "Farzad Torabi" :

> Hi All

> I have a part of my Matlab code written with 

>     catch ME
>         warning('found error in %dth file', i);
>         fprintf('Error: %s\n', ME.message);
>         continue

> but in Octave I get this error :

> error: octave_base_value::int64_scalar_value(): wrong type argument 'complex scalar'
> error: called from
>     MyCode at line 414 column 9
 
Have you checked that "i" is defined in this context? If not, it defaults to the imaginary unit for complex numbers.
I'd advice to avoid using "i" and use a different variable name (maybe "iLoop").

Markus



Reply | Threaded
Open this post in threaded view
|

Re: Error with Catch ME continue

mmuetzel
Am 23. Oktober 2019 um 09:49 Uhr schrieb "Farzad Torabi":
> Thank you very much ! that was it ! I had changed it from i to f in the top of the loop and not down here. thanks for the fast recognition !

You're welcome.
Please, keep the mailing list in CC to let others know that your problem is resolved.

Markus


> On Wed, Oct 23, 2019 at 9:44 AM "Markus Mützel" <[hidden email][mailto:[hidden email]]> wrote:
> > Am 23. Oktober 2019 um 08:38 Uhr schrieb "Farzad Torabi" :
> > > Hi All
> > > 
> > > I have a part of my Matlab code written with 
> > > 
> > >     catch ME
> > >         warning('found error in %dth file', i);
> > >         fprintf('Error: %s\n', ME.message);
> > >         continue
> > > 
> > > but in Octave I get this error :
> > > 
> > > error: octave_base_value::int64_scalar_value(): wrong type argument 'complex scalar'
> > > error: called from
> > >     MyCode at line 414 column 9
> >  
> > Have you checked that "i" is defined in this context? If not, it defaults to the imaginary unit for complex numbers.
> > I'd advice to avoid using "i" and use a different variable name (maybe "iLoop").
> >
> > Markus



Reply | Threaded
Open this post in threaded view
|

Re: Error with Catch ME continue

Farzadtb
Sure , thank you

On Wed, Oct 23, 2019 at 9:55 AM "Markus Mützel" <[hidden email]> wrote:
Am 23. Oktober 2019 um 09:49 Uhr schrieb "Farzad Torabi":
> Thank you very much ! that was it ! I had changed it from i to f in the top of the loop and not down here. thanks for the fast recognition !

You're welcome.
Please, keep the mailing list in CC to let others know that your problem is resolved.

Markus


> On Wed, Oct 23, 2019 at 9:44 AM "Markus Mützel" <[hidden email][mailto:[hidden email]]> wrote:
> > Am 23. Oktober 2019 um 08:38 Uhr schrieb "Farzad Torabi" :
> > > Hi All
> > > 
> > > I have a part of my Matlab code written with 
> > > 
> > >     catch ME
> > >         warning('found error in %dth file', i);
> > >         fprintf('Error: %s\n', ME.message);
> > >         continue
> > > 
> > > but in Octave I get this error :
> > > 
> > > error: octave_base_value::int64_scalar_value(): wrong type argument 'complex scalar'
> > > error: called from
> > >     MyCode at line 414 column 9
> >  
> > Have you checked that "i" is defined in this context? If not, it defaults to the imaginary unit for complex numbers.
> > I'd advice to avoid using "i" and use a different variable name (maybe "iLoop").
> >
> > Markus



--
SeyedFarzad Torabi
Master of Mech. Eng.
Politecnico Di Milano