01-16-2020 02:03 AM
Hi all,
so I'm trying to read data from a text file, and plot them onto an XY graph.
The string text data file is built as such:
XXX;Time/Date Stamp;Data point type A;1;X
XXX;Time/Date Stamp;Data point type B;2;X
XXX;Time/Date Stamp;Data point type C;3;X
XXX;Time/Date Stamp;Data point type A;1;X
XXX;Time/Date Stamp;Data point type B;2;X
. . .
Say I want to plot only point A with the corresponding time stamp, and the data points are distinguished from each other through a number after the semicolon, in this case 1. And if I want the graph for point B I would match with 2 and so on.
How do I get the indexes of all the corresponding row that matches with 1 so that I am able to extract them along with the time stamp to plot the graph for data point A?
I attached a snippet of the simplified version of what I have so far and it's not quite right because I'm not getting the correct plot.
Thank you in advance!
Solved! Go to Solution.
01-16-2020 02:09 AM - edited 01-16-2020 02:11 AM
Hi nikvl,
after creating the arrays for timestamps and "data point" you also should create an array of "position".
Then feed all 3 arrays into a FOR loop containing a simple comparison with desired "position" value. Then use conditional output tunnels to create filtered arrays of timestamp and "data points"…
Example:
01-16-2020 04:23 AM
I had to tweak some things and add an extra for loop but it worked wonderfully. Thanks!
Unrelated, but is there a way to make the array of time stamps into seconds starting from 0? (or should I open a new thread for that?)
01-16-2020 04:25 AM
Hi nikvl,
@nikvl wrote:
Unrelated, but is there a way to make the array of time stamps into seconds starting from 0?
Simple math:
Relative time := absolute time - start time
So just subtract start time from your timestamp array…
01-16-2020 04:48 AM
I figured, but it skewed the display and the year became 1904. Maybe I'm not setting the start time properly since I used an index array with index 0 (when the index should be at what row the desired data point first appears)
If possible, I'd like to display in seconds without the year like 0, 1 , 2, ....
01-16-2020 05:26 AM