LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting array columns with store button

Hello

Just started with this Labview stuff


can anyone help with the following problem:

I have signals acquiring continuously and various calculations, these results are displayed in real time on the front panel.
I would like to able to press a 'Store' button which will take a snap shot of values of say three items x, y and z. These values need adding to an array at row 0 onwards and form three separate columns of data.

i.e

Row| X Y Z
0| 12 -1 3
1| 2 10 11
etc|
etc|

Each store button press would increment the row index and store x, y and z at that position. Finally when the stop button is pressed the whole array is written to a spreadsheet. This last part is ok.

I have tried various methods, like: case for store button, shift regs, clusters to array etc It's easy to append x,y,z to the same column.

Any ideas would be welcome.
Ieon
0 Kudos
Message 1 of 7
(3,567 Views)
Hi leon,

I think you are not using the correct function for what you want to do. LabVIEW does not allow you to insert an element after the last element of the array X.
The easiest solution to your problem (according to me) is to replace your insert element to array with the Build Array.

Here is a little example of what I mean !
Hope this helps !
Julien
0 Kudos
Message 2 of 7
(3,544 Views)
Hi Julien

Thanks for the suggestion.

I've tried a simpler version to yours, but what do you do about the false case state, as what ever you put in this state gets overwritten to that element when the store button is not pressed.

I used some shift regs on the while loop and got some results, but all three vars are in one column.



Ieon
0 Kudos
Message 3 of 7
(3,536 Views)
Hi Leon,

I wrote a VI that do what u asked for. If you have any questions, write them here...

Hope it helps ....
0 Kudos
Message 4 of 7
(3,526 Views)
Hi

Thanks for your store.vi code

Couldn't get it work correctly. The while loop I have is used for data acquistion and is running fast and the index count is of no use.
I also may of not explained the problem unambiguously, the word ROW in the above example and the values under that column were to show the index and were not part of the saved data.

My main program acquires data from H/W in a loop and various calculations are performed on the fly and the results are displayed on the front panel correctly as double precision values.

Let's say this displayed data is x, y and z respectively. At some time let's say when x=2, y=4, z=6 I press the STORE button. Then at a different time later the data is x=1, y=3, z=7 and I press STORE again. This could continue like this, each time the store button is pressed adds a new ROW of the three COLUMNS x,y,z to the array. If in this case I now press STOP, the array along with X Y Z string header is saved to a file. Below is how the file contents of the data should look exactly for the above example:-

X Y Z
2 4 6
1 3 7

I've only used small numbers due to the forum only allowing one space char, for clarity.

Any ideas welcome! thanks in advance for your help
Ieon
0 Kudos
Message 5 of 7
(3,507 Views)
Hi Leon,

This forum is not designate to get the whole VI u need. It designate to get help if u don't know something or stucked at a proggraming point. The VI i sent, does what u asked for, and here are my comments:

1. Why you "Couldn't get it work correctly" ?

2. If you don't need Indicators that i put at the Front Panel, u can delete them. They are there just for debuging the VI for your help, seeing how the variables changed....

3. The index count is connected to an Indicators, for your convenient, to see if the proggram is running or stucked. You can of cource delete it....

4. The data acquired from your H/W must to be connected to the Control named "Data Array". I didn't write any Daq VI that will collect your samples.

5. If you didn't need the String "Row" at the header of the file, you could delete it, and remove the adding of the counter to the 2D array ...

6. If the loop interval are too fast, then increase the time delay at the "Time Delay" Express-VI.

I connected a graph control to the saved points. here is the new VI.

Hope you will succeed...

Bush-Man
Message 6 of 7
(3,484 Views)
Hi Bushman

Thanks for the VI

It all works perfectly now, thanks to you.

I'm new at this labview thingy and it's a strange concept 'graphical programming' after spending too many years programming in C/C++.

Good job this forum is here with kind people helping like yourself.

I did create a new version that simply uses a button that increments an signed integer that's used for the row index and it seems to work ok.

Thanks again: owp yuoos r ok
0 Kudos
Message 7 of 7
(3,468 Views)