LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can we throw an exception with the PolyFit command?

Let say the caller sends not identical arrX & arrY size, then the PolyFit will generate an error. With the GetAnalysisErrorString we can know what error is it!
 
However can we declare some thing as  i_bPrevBreak = SetBreakOnLibraryErrors (FALSE); and  SetBreakOnLibraryErrors (i_bPrevBreak); // restore previous break condition in oder to throw an exception?
 
Note: The 2 above commands do not work in this case!
 
Thanks to any help

0 Kudos
Message 1 of 4
(3,110 Views)

I found the command:

int oldValue;
oldValue = SetBreakOnProtectionErrors (0);
/* Statement that erroneously reports an error */
SetBreakOnProtectionErrors (oldValue);

Smiley Wink

0 Kudos
Message 2 of 4
(3,105 Views)

Oopps,

I did try over and it does not work when the size of array_X is less than the size of array_Y, sorry about my early successful comment ... it still displays the error (as attachment). SO if someone know better protection please help! Smiley Sad

0 Kudos
Message 3 of 4
(3,099 Views)

It is very embarassing, the first commands are good. To pay my mistakes here is the codes which working in my case:

 /* Statement that erroneously reports an error */
 i_bPrevBreak = SetBreakOnLibraryErrors (FALSE);
 i_error = PolyFit (db_arrX, db_arrY, i_size, i_degree, db_arrOutput, db_arrRet, &mse);
 SetBreakOnLibraryErrors (i_bPrevBreak);
 
 if(i_error != 0)
 {
  sprintf(str, "Error nuber = %d", i_error);
  MessagePopup ("SCI_LEASTSQUAREFIT ERROR", str);
  return db_arrX;
 }

*) Sometimes, it is just a bad day! Smiley Tongue

0 Kudos
Message 4 of 4
(3,096 Views)