Print to Page   |   Sign In   |   Register
Forum: Scilab Users' Group: try - catch
Search ForumsForums
Share |

4/13/2012 at 10:18:36 AM GMT
Posts: 28
 
Subject: try - catch

Hi.

 

I am trying to use try-catch function but when an error occurs the code between catch and end is not calculated.

So i tried to put on the errcatch function wihtout results.

Can anyone explain me why ?

 Here is tcode :

 errcatch(-1,"continue");

try
data=fscanfMat('MESURE-FB.TMP');
choix=data(data(:,1)==NumPiece,:);
catch
choix=[NumPiece,-1000,-1000];
end

errcatch(-1);

 

 

 

Thank you.

 

Frédéric

4/13/2012 at 11:34:06 AM GMT
Posts: 214
 
Subject: RE: try - catch
F. Blanchard said:

Hi.

 

I am trying to use try-catch function but when an error occurs the code between catch and end is not calculated.

So i tried to put on the errcatch function wihtout results.

Can anyone explain me why ?

 Here is tcode :

 errcatch(-1,"continue");

try
data=fscanfMat('MESURE-FB.TMP');
choix=data(data(:,1)==NumPiece,:);
catch
choix=[NumPiece,-1000,-1000];
end

errcatch(-1);

 

 

 

Thank you.

 

Frédéric

 

Hi.

You cannot use errcatch with try..catch.

I usually use pause for debugging.

To see what is wrong try:

try
   data=fscanfMat('MESURE-FB.TMP');
   choix=data(data(:,1)==NumPiece,:);
catch
    pause
    choix=[NumPiece,-1000,-1000];
end

Stanislav
5/26/2012 at 5:01:00 PM GMT
Unknown
Posts: 0
 
THIS POST HAS BEEN REMOVED BY A MODERATOR OR ADMINISTRATOR.
Community Search
Sign In

Username
Password

Forgot your password?

Register Now!

Scilab Tips


Privacy Policy © 2013 Equalis LLC Terms of Use