LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error code -90032 comes up unexpectedly when running math script with Labview 8

Hello,
 
I have a math script inside a Labview subvi; sometimes, out of the blue, I get the error :
Error in function select_prob at line 6.  The indexes are out of bounds for the variable you specified.
 
select_prob is an array that is input to the script.
 
Can anyone please tell me how to fix this error and explain why it pops out of a sudden?
 
Thanks
0 Kudos
Message 1 of 7
(3,864 Views)
Errr... Maybe because you're trying to index an array out of its bounds? That's what the error is trying to tell you. E.g., You're asking for the fourth element of an array when you've passed in an empty array or an array with only two elements. Your question is too vague without seeing code.
0 Kudos
Message 2 of 7
(3,855 Views)

Hello,

I am passing an array of size two; and the array is never empty, it is always pouplated before being passed to the script; the funny thing is, the script would run fine , then it would suddenly stop working generating this error, and if I just press enter to add a blank line inside the script , it starts running fine again !!

here is the code :

///////////////////////////////////////////////////////////////

 j=1;
    p=select_prob(j);
   
   while(p<r)
       j=j+1;
       p=p+select_prob(j);
    end;
     
 j=j-1;

///////////////////////////////////////////////////////////

select_prob is 1-D array of size two , in this case; r is a scalar, and j supposed to be the script's output.

Appreciate your help.

 

0 Kudos
Message 3 of 7
(3,846 Views)
You didn't say where r is being set, so I assumed it's another input to the script. The problem is that your script is fundamentally flawed. Depending on r you can get j to go beyond the bounds of the array. For example, let's say the largest value in the array is 3 and r is 4. The script runs without error. If r is set to 5 then you get an error because of your test in the "while" clause - j will become 3 and hence you try to index a select_prob(3), which doesn't exist.

I don't know if the two element array that you're using was for demonstration purposes, but the thing I need to ask is why you're trying to do something like this in a MathScript. Is this a real application, or a "I'm just playing around with MathScript"?
Message 4 of 7
(3,841 Views)

Thanks for the feedback; r is an input to the script; it is a randomly generated variable btwn [0,1]; I will look into the case when r is larger than either entries in array.

I am a newbie to LABVIEW , and sometimes I found it easier to use a script rather than using a while loop. Do you know if that would affect the running speed of the code ?

 

 

0 Kudos
Message 5 of 7
(3,837 Views)
For something trivial like this doing it LabVIEW is going to be way faster because you don't incur the penalty of needing to load the script engine. I would recommend looking at some of the available courses on LabVIEW and/or programming as well as books on the market. You can start with this one: LabVIEW for Everyone.
0 Kudos
Message 6 of 7
(3,832 Views)
Thank you
0 Kudos
Message 7 of 7
(3,828 Views)