From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting datamatrix by output frequency

Hi, I have trouble finding out how to solve a problem in Labview

 

I am working on improving a program so that it may present data in different frequencies. My NI6211 reads 1000 analog samples per channel and second. I want to be able to display this data with various frequencies as i want to study transients more closely.

 

The program used to run in 20hz, thus i presented 20 values every second and channel, each value the mean of 50 samples. When i had a fixed frequency of 20 i just told the Read.vi to get 50 samples every 50ms working cycle, used "index array" to split it into 15 1D rows and calculated the mean for each row. The rows were then assembled back into a matrix and used as output.

 

Now i want to be able to run in 100hz/10samples (and also 50/20, 200/5, 500/2....). I have also changed the working cycle time to 60ms for other reasons.

 

DAQmx thus reads 60 samples on 15 analog channels every working cycle, and so i get a data matrix of 15x60.

Is there a way to split it into smaller pieces of 15x(sampling speed)? For example if i used a frequency of 100 i would get 6 sets of 15*10, allowing me to calculate the mean value of smaller intervals. For 500hz i would get 30 sets of 15*2 etc...

 

 

Is it possible to split a matrix into equally wide columns? Can it be solved with an indexed for loop?

Any help would be appreciated, im still a beginner at Labview!

 

 

0 Kudos
Message 1 of 2
(2,086 Views)

Your current code can be replaced by an autoindexing FOR loop, you only need once instance of the "add array elements" operation. Easiest would be to acquire it as a 1D array with a constant number of samples then use "reshape array" to create a 2D array of the desired dimensions to be used for autoindexing as suggested.

0 Kudos
Message 2 of 2
(2,080 Views)