LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mathscript

hi guys i've given 1D arrays of voltage and current from daq NI6008 as input to the mathscript as shown in the vi.

mathscript error3.JPG

 

the daq inputs are sampled as shown below

mathscript error4.JPG

 

when i run the vi, it is giving an error as shown below.

mathscript error2.JPG

i've changed the sampling rate. but still it is showing some error.

 

what shall i do now?

 

0 Kudos
Message 1 of 5
(2,703 Views)

Please include a Snippet of your code, or attach your VIs, so that we can better assist you. We are here to help, but won't spend all day recreating your code from scratch just to help.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 5
(2,672 Views)

see i've attached my vi along with this. i've used daq ni6008.

if it asks for some path, create a text document on yyour system and direct to that.

choose some random pins for the daq inputs.

i think this screen shot will help you

 


 mathscript error6.JPG

0 Kudos
Message 3 of 5
(2,668 Views)

please give response as soon as you can

0 Kudos
Message 4 of 5
(2,658 Views)

Here's my trace-back of your problem:

  1. The error is because you're trying to index an array in your mathscript at an index that doesn't exist.
  2. So your array "v" is being indexed at a value up to "k".
  3. "k" is equal to "rate", which is set = 5 in your source code.
  4. Therefore, "v" must be size 5 or bigger to get rid of the error.

You are reading all available samples at your DAQmx Read VI every 1000ms. Delete the 1000ms Wait and, instead, wire your "rate" value in to the input on DAQmx Read "number of samples per channel". This will force your loop to wait until 5 samples have come in and continue, which will then in-turn make the loop run every 1000ms.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 5
(2,651 Views)