galluccinator Posted July 30, 2014 Report Share Posted July 30, 2014 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! Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted July 30, 2014 MVP 2022 Report Share Posted July 30, 2014 Why not determine the range as you go? Simply check each new number to be greater than the last highest number or less than the last lowest number and if true store it for the next check. Quote Link to comment Share on other sites More sharing options...
galluccinator Posted July 30, 2014 Author Report Share Posted July 30, 2014 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. Quote Link to comment Share on other sites More sharing options...
MVP 2022 Flex727 Posted July 30, 2014 MVP 2022 Report Share Posted July 30, 2014 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. Quote Link to comment Share on other sites More sharing options...
Alexander Posted July 31, 2014 Report Share Posted July 31, 2014 In addition to the above solutions, there also is a read column function block that will allow you to copy a given number of rows into a vector of operands. The benefit of using this function blocks is that you can then use the vector tools within the logic. 1 Quote Link to comment Share on other sites More sharing options...
galluccinator Posted July 31, 2014 Author Report Share Posted July 31, 2014 Thanks! I actually just discovered that function this morning, worked like a charm! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.