LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I scale arrays of waveforms?

Solved!
Go to solution
Hi, I hope you can help with this.

I'm reading in 6 channels of analog data  from a USB 6008 at 1000 samples/second, in 1000 sample blocks  in a  loop . The data arrives from DAQMX as an array of 6  waveforms.

I want to (y-)scale all the data such  that channels 0, 1, 2 are divided by 3 (because the electronics has a 3x gain  op-amp on those channels) and channels 3, 4, 5 are divided by 15 (because the  electronics has a 3x gain, and there is a 5ohm resistor and I'm trying to  measure current).

You'd think it would be ridiculously easy ....  but :
(1) labview's 'scale and offset' vi only works on  individual waveforms (not arrays of waveforms)
(2) inserting a matlab or matscript node doesn't allow me  to work on waveforms, only arrays
(3) using a simple 'divide' VI it proves impossible to set  the denominator as just a single  number .. '3'!

any ideas? as usual it's the kind of problem people must  face all the time

Dave
0 Kudos
Message 1 of 9
(4,180 Views)

Use an array of values rather than a single number:

 

Message 2 of 9
(4,165 Views)
Solution
Accepted by topic author oilyfingers

Hi Dave,

 

This is how I would do it - use array of divider values.

 

Hope this helps - example in lv 8.6.

 

Kind Regards,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 3 of 9
(4,158 Views)

Well, what about scaling with different constants and adding different constants of array like Ax+B to all channels.

 

This would help much for me.

 

Best Regards,

Bertan

0 Kudos
Message 4 of 9
(3,481 Views)

Hi Norian,

 

nothing has been changed since the solution to this question was posted 10 years ago!

Use constant arrays to calc your scaling…

 

(Or even apply scales on your DAQmx channels!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(3,478 Views)

But still getting an error like below. How can I solve this?

 

Best Regards,

Bertan

image.png

0 Kudos
Message 6 of 9
(3,471 Views)

Hi Bertan,

 

why do you need a FOR loop? Why do you create a 2D array of waveforms?

Why do you work with 2D arrays? (Use IndexArray instead of ArraySubset!)

It's all your fault… 😄

 

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(3,456 Views)

@DeltaVUzay wrote:

But still getting an error like below. How can I solve this

 


I would use the DAQmx scales so I wouldn't have to worry about doing the math on my own.

 

But with your setup, you really should wire your 2D array straight to the FOR loop, autoindexing on it.  This will iterate over the row.  Now you just use Index Array to get the two elements in your row and multiply by the first, add the second.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9
(3,455 Views)

Thanks for your brief replies! Smiley Wink

 

 

0 Kudos
Message 9 of 9
(3,444 Views)