Jump to content

Only copy part of a Data Table column to a vector?


Recommended Posts

Hello,

 

My project involves filling a data table with real time data, and in order to progress through the experiment it needs to read the last 100 values recorded, sort them, and then get the resultant range. So I only need to read the last 100 values of the column I am currently fillling up during the program, but I only see a function that copies the entire row to a vector. This wouldn't work as the column has more numbers than the MI memory has operands. Is there any way to only put part of a column into a vector?

 

Thanks in advance!

Link to comment
Share on other sites

Normally that would work, but not in this case because the experiment is highly sensitive and the instruments are likely to have some noise associated with them. You might get an abnormally large or small run which would throw off the range if it was taking every one into account. The way I have gotten around this is to store the 100 values into a vector, sort them from smallest to largest, cut off the top and bottom 5% (to remove extreme outliers), and then get the range from the higest and lowest one in the set.

Link to comment
Share on other sites

  • MVP 2023

In that case, create another Data Table with a single column and only 100 rows. Send the data to this table also, shifting the entire table down one row prior to each entry. This will maintain the last 100 data points and allow you to read them out into 100 MIs when you want to do your range calculation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.