PDA

View Full Version : MAX behavior



hcrisp
01-22-2010, 08:17 AM
I am getting a strange error from MAX. My code occasionally hits an error in a function that calls MAX. It's inconsistent since when you run it again it won't error. The error looks like this:



%%%Error occurred at MYFUNC <myfunc.pro( 5)> (MAX).
%%%Called from MYPROC <myproc.pro( 184)>.
...


Or sometimes like this:



%%%Execution halted at MYFUNC <myfunc.pro( 5)> (MAX).
%%%Called from MYPROC2 <myproc2.pro( 184)>.
...


The offending line in MYFUNC is this:



...
id = x NE 0
mx = MAX(id)
...


What possible input into MAX would give this error? It looks like the "NE" line would only result in bytes, but I have tried byte, integer, float, double, string, NAN, infinity -- they all give valid results. Maybe this only occurs in WAVE 8.0. Any suggestions?

donb
01-29-2010, 01:51 PM
Hi hcrisp,

I'm not sure what inputs to MAX can generate the errors in your post but I'll look into that.

When you see these errors, what is 'x', and what ends up in 'id'? I'm interested to know the type, size and shape; 1-D integer array, 3x2 double array, byte scalar?

Don B.

hcrisp
02-01-2010, 08:29 AM
The contents of both 'x' and 'id' should be a byte array (length 2), but I'm trying to determine if something unexpected is actually triggering the error.

MYFUNC is called like this:



; 'str' is a string'
val = STRMID(str, 7-i, 1)
IF NOT MYFUNC(val EQ ['0', '1']) THEN ...




PRO myfunc, x
id = x NE 0
mx = MAX(id)
...
ENDPRO


So, you see, 'x' can only be a byte array of length 2, and thus also 'id'.