07-19-2024 07:21 AM
"Thanks!
I've looked into state machines, and they indeed seem optimal.
Right now, I'm trying to first extract the data while the loop is running.
I'm stuck and don't know how to do it.
I'm using comparisons (> cursor[0]
and < cursor[1]
) and the "and
" boolean to select the data between my two cursors, but I don't know how to extract them.
I've seen one of your posts that seemed to have the event
structure, but I didn't really understand the code and
I can't implement it.
Any ideas?
07-19-2024 07:36 AM
I'm not sure about the comparisons since the values from my array are on the "Y" axis and i'm using "posX".
07-19-2024 08:43 AM
One way I would do is to use the Cursor.PosX for each cursor use these values to apply for Array subset, the first cursor is the index, the absolute value between the difference between Curso 0 and Curso 1 is the "SIZE", with that you will be able to select the portion of your signal to be exported to excel.
You could use the solution you were using, but after getting the arrays of booleans, you will need to run the array of booleans to each value of your array of data to select the data you want. It would do the same thing, but Array subset is already implemented for you to use.
I would like to reinforce the State machine, after your program finishes collecting data, your program would to to a "select data to excell" state where you would show the data and allow th e use to export to excell.
07-25-2024 11:17 AM
@Alexb91 wrote:
I'm not sure about the comparisons since the values from my array are on the "Y" axis and i'm using "posX".
If you have two cursors and define a rectangle and want to select a subset of xy points that fall into that area, you should probably start with an xy graph. A waveform graph assumes points equally spaced in x, but points that fall into a certain Y range could well be scattered over many discontinuous segments. (I fake it by setting outside points to NaN).
As I already said, you are using x for one cursor and y for another cursor and it is not obvious how that should put desired bounds on your data. Can you show a sketch of the data and cursors and point to the area you like to select?
07-30-2024 07:51 AM
Hi, here is an example of data i'd like to select.
07-30-2024 07:53 AM
The problem is that I don't know how to create an xy graph with an array, as I have 9 signals and not just two.
07-30-2024 08:23 AM
You don't need to create XY .
Go back to your data graph, you are ploting 2D array of data.
Right click on your plot, and select properties
On the tab Cursors, on Allow Draggin, select single-plot and select Trace 0.
this will "lock" the cursor with your first plot.
Then the diagram you will use the property node, Active cursor and Cursor Index, will give you the index of the cursor , with that information you will use Array subset to select the portion of the data you want to save it.
I suggest to save to a CSV file to make things easier, to export to Excell you will need to use Active X. You can add the cursor X 1 and X2 to knwo the portion of the data you are saving.
07-30-2024 08:28 AM - edited 07-30-2024 08:29 AM
Thanks for your answer.
It seems like a good idea and much less of a hassle than using loops and booleans.
I tried it, but I'm not getting any values in my subarray.
Did I make a mistake somewhere? I've attached two screenshots and my current code.
07-30-2024 08:41 AM
Why do you suggest locking the cursor on the first plot since there is 9 plots?
07-30-2024 09:12 AM
@Alexb91 wrote:
Hi, here is an example of data i'd like to select.
So you want to leave out the white data at the bottom? What should happen if some data is only selected partially?
Do all the traces really have different x-values that are randomly spaced?
How do you want the output of the selection arranged?