Looking to collect data and index with a button push. Here's what i have so far, the counter increments and saves the data for the last data point only. What am i missing? I'd like to send this excel and show 16 data points, column A is the index (count) and column B is the data captured at each button push.
Also you should put the save to file portion in the case where you measure or not.
What you have now will probably constantly write lines of zeros to your data file whenever the measure case is false.
I would also suggest that you might want to consider an Event Structure. That should simplify (remove) the polling and remove the need for a case structure for the measurement - you probably only need two cases, "Measure : Value Change" and "Stop : Value Change" or similar (i.e two button presses).
I don't think it's a good idea recommend event based programming to newbies.
As (IMHO) event structures break the data flow paradigm, and that is the main thing new users really, really, really need to grasp and fully understand before they can tackle more complex programs.
OK bringing this back to life now that i'm able to work on it again.
Think of it this way... I am using DAQmx to read a sensor, the data is being saved as long as the app is running. What i would like to do is add a level of simplicity to the app for the operator by providing a template of Indicators on the Front panel to be populated with a simple button push.
So the data is running continuously...the operator pushes the button...indicator box (1) gets filled with a value...the button is pushed again....indicator box(2) gets a value at that instance of time....etc.
What we're doing is using a chart to see the measurement values continuously, we move the sensor to different positions and take a data point once the sensor is in position and the data has stabilized.
Here's what i have so far...i'm able to grab the data with each button push and count the button pushes but it's being overwritten each time. I think i need a 2D array to do this correctly but can't manage to capture exactly what i need.
How does this look?
Here I'm using a 1D array, which will make display much simpler. However, if you really want 2D array visualization, you'd probably want to use the Reshape Array function to get the dimensions you wanted.
This provides a quick fix, but note that on starting the array is filled with the default value
That might not be so bad (especially for DBLs), but just note that it happens! Also, in this example the Reshape Array is called every time - probably you only need to update the indicators when something changes, so consider moving them into the Case Structure (after the new value is added).
Dimension Size is added so you can see the effects on initialization - probably you'd want a constant, or a calculated value, rather than a control.
You could consider making use of the NumRows or NumCols property nodes available when you right click the Indicator, and go to Create > Property Node > (scroll to near bottom) NumRows / NumCols. These values tell you the visible size of the array indicator (not the size of the data, which you'd use Array Size for!).
Take care not to limit both (set the Dimension Size control to a small value and watch what happens). If you change the index of the array on the front panel, it won't scroll the data if you limit the size. As a result, you might want to use Quotient and Remainder and Increment to find the second Reshape dimension size.