LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Select data between cursors on a graph

Solved!
Go to solution

Hi,

For my project, I'd like to select data between cursors on a graph and export them to an Excel file.

 

To achieve this, I'm using property nodes for the cursors.

I want to use a case structure to build an array from the data that falls between the cursors.

 

However, I can't connect the boolean result from the comparisons to the case structure.

Any ideas?

Thanks!

0 Kudos
Message 1 of 25
(3,434 Views)

@Alexb91  a écrit :

I can't connect the boolean result from the comparisons to the case structure.

Any ideas?


Hi Alex,

 

Output of your AND function is an array of booleans.

Input for the case structure is boolean.

 

PinguX_0-1720708312942.png

 

0 Kudos
Message 2 of 25
(3,422 Views)
Solution
Accepted by topic author Alexb91

I assume you want two different x positions, not an x and a y position, right, so why are you reading the y position?

If you would uses cursors that are locked to the plot, you can use "cursor index" and get the array subset based on the positions. No FOR loop needed!

(simple old example here, but there are many others)

 

altenbach_0-1649519129750.png

Message 3 of 25
(3,388 Views)

Interesting.

The problem is I have multiple plots shown on the graph.

 

Could this still work?

0 Kudos
Message 4 of 25
(3,374 Views)

Thanks i’ll try it out!

0 Kudos
Message 5 of 25
(3,372 Views)

Correct, I just want two x positions.

 

My idea is to store the data between the cursors in an array during each iteration. Then, I want to write this data to an Excel file.

I'd like to have a "write to Excel" button so that each time I press this button, it starts an iteration.

 

Ideally, this would be outside the while loop, so that I extract the data when all the measurements are finished and the while loop is stopped.

 

Do you have any ideas on how I could achieve this?

 

 

0 Kudos
Message 6 of 25
(3,340 Views)

@Alexb91 wrote:

 

I'd like to have a "write to Excel" button so that each time I press this button, it starts an iteration.

 

Ideally, this would be outside the while loop, so that I extract the data when all the measurements are finished and the while loop is stopped.


You have contradictory and silly requirements. That don't make a lot of sense

 

Writing to excel is not the same as starting an iteration, so please clarify what should happen.

 

Your toplevel program architecture should be a simple state machine, where writing the subset to file, staring a new acquisition, do nothing, and everything else is just a state. Nothing should ever be outside the toplevel loop (except maybe initialization and cleanup code).

0 Kudos
Message 7 of 25
(3,295 Views)

@altenbach wrote:

 

(simple old example here, but there are many others)

 

 


i remember the original post 😄

0 Kudos
Message 8 of 25
(3,256 Views)

Sorry, I'll try to be clearer about what I'm trying to achieve.

 

Basically, at the end of the data acquisition, I want to select data between cursors.

Then, I want to have a button that prints said data into Excel file.

 

I want to create a different file each time I press the button.

For example:

  • File 1 = data from 1 am to 3 am
  • File 2 = data from 4 am to 6 am

I want to perform this operation outside of the while loop because I want to do it when the data acquisition is stopped.

0 Kudos
Message 9 of 25
(3,233 Views)

@Alexb91 wrote:

I want to perform this operation outside of the while loop because I want to do it when the data acquisition is stopped.


It is clear what you want. As I already said, no interactive code should ever be outside the toplevel loop. All you need is a state machine where one state is recording data at regular intervals, and one state is idle (no recording or waiting for an elapsed time before recording the next datapoints) and a state for saving. If it is outside the loop, you can only save one set unless you place yet another loop for repeated saving. It is silly to have multiple consecutive loop if you really only need exactly one! Done right, you can even select and save a selection while it is still recording new data.

 

If the recording should be fast, it can be in a parallel while loop communicating with the UI loop via queues, for example. Your recording seems to be quite slow, so a little jitter due to saving is probably irrelevant.

0 Kudos
Message 10 of 25
(3,220 Views)