From: Amol Patil on
Hi Everyone,

I have a large array ( say 500 by 100) containg experimental data ( each column representing a dataset. I have been programmatically fitting each dataset with a theoretically predicted function , using curve fitting tool box.

For few of the 100 datasets, fit gives the following warning
"MaxFunEvals (in fit options) may allow for a better fit, or the current equation may not be a good model for the data", before moving on to the next.

How could I generate a logical flag ( say warning=1) when the warning is generated?
( the idea being that to isolate/filter aberrant datasets by appending the flag to the same)

regards
Amol
From: Tom Lane on
> How could I generate a logical flag ( say warning=1) when the warning is
> generated?
> ( the idea being that to isolate/filter aberrant datasets by appending the
> flag to the same)

Amol, perhaps you just want to look at lastwarn:

>> lastwarn('')
>> a = inv(eye(4));
>> isequal(lastwarn,'')
ans =
1
>> a = inv(ones(4));
Warning: Matrix is singular to working precision.
>> isequal(lastwarn,'')
ans =
0

-- Tom