09-23-2010 06:32 PM
I am trying to build an array from my continuously sampled data. It seems like I should be using a shift register or something along those lines, but I haven't been able to figure it out.
Here is the run down on my project. I'm using a NI USB-6009 device to collect 4 analog voltage signals (2 load cells and 2 displacement transducers). On the main panel, the user has a choice to what they want to do in a listbox (Check EMG Channels, Collect Baselines, Collect Data, and End Program). My questions has to do with the "Collect Data" option.
For the collect data option, I am continuous sampling until the user Stops Data Collection. This appears to be working, but now I need to take the data from my 4 channels and store it an an array (or something similar) as it's being collected. I want to be able to subtract baseline values from the continuously sampled data and to apply a calibration equation to display the voltage in either Newtons or millimeters (I plan to add waveform graphs). I also want an output of the data that was produced (from time start until the user stops data collection).
So, does anyone have suggestions on how to take this continuously sampled data I'm acquiring and store it for further manipulation and so I can output the data?
I would also appreciate useful examples that are similar.
Thanks in advance,
Esther
09-24-2010 05:29 AM
HI Esther,
In your code the procedure to built the array is right. But few things you have to consider.
1. You have to follow any of the architecture.
2. In the code instead of list box . you can use type def ENUMs.
3. In the place of manual feeding of array index, you can use the iteration "i" value and you can pass.
4. Handling Array, you need some to consider few things. Just check the Example programs in LabVIEW.
5. Better remove flat sequence and use statemachine Architecture.
6. Without delay you should not run the while loop it will affect the performance of the CPU in other applications.
7.Error handler is very nessesary
Read this :http://forums.ni.com/t5/LabVIEW/Array-Manipulation/m-p/1104580
All these comment are not to blame you... to improve your coding.
<<Kudos are welcome>>
09-24-2010 01:41 PM
Thanks for the reply. I am new to LabVIEW and appreciate the coding tips and will focus on using more state machine architecture using ENUMS. However, your broad answer has not helped me to answer my specific question regarding building the array from continous data.
First, I cannot open your attachments. I only have access to Labview 8.2.1 and it would not allow me to open the LabVIEW 9.0 files. Is there a way you could send them in a version I can open or do you have suggestions on how I can view them?
Second - I do not believe the code I attached (Sept 23_Build Array During Data Collect.vi) is building an array. I have an array indicator (Before Build Array) that only fills in the first element. The array size indicator (Array Size) also says 1, indicating that only a single number is ever being stored in the array. I need ALL the numbers to go in here.
I have tried using shift registers (see attached code: Sept23_MainPanel_WorkingBaselines_ApplyBaselinesand Calibration.vi). This appears to put more data into the array indicator (Before Build Array) but nothing feeds into a second indicator (After Build Array) - I don't know why. However, my problem here is that memory can fill up depending on how long this is fun - so I think I need a buffer to store information.
I know you said to look at examples - which I'm trying to find - but could you be specific and name a particular example that would be helpful to me?
I'm hoping for some more specific advice about this particular issue I'm facing or specific examples to follow. Thanks for the general coding advice.
09-27-2010 01:00 AM
Hi,
Sorry i thought your problem. in some other way..
in your Vi the second circle is the problematic one, Here in index array you are taking the 1D element out. but ou are over right upon a single index, Tats whyit shows the final or last value the DAQ send. as well as the array size. See the attached file one basic array builting is there try it.
The previous out put is feed through local variable. The new value is appended on the same array. so then you can get the whole array values.
Try it. If you find any diffculties. feel free to post it again..
<<Kudos are welcome>>