LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you write a table to a file when you push a button in Labview 8.5

Solved!
Go to solution

I am new to LabVIEW so I do not know if this is hard or not or can even be done. I have data that I am colleting and storing it into a table in LabVIEW but I want to be able to take the entire table of data and write it to a file, text or excel. Another part I would like is to have it be done when a user presses a button, in case they messed up. Any help would be appreciated. Thanks!

0 Kudos
Message 1 of 7
(4,041 Views)
Solution
Accepted by topic author dpkiley

That's not hard to do. If you have a main loop that's continuously collecting data then you can just wire up the Boolean control to a case structure so when the button is true you write to file. Is this supposed to be a one-shot operation, or is more of a toggle (meaning you log while the button is true)? You can also use an event structure. See the "New Event Handler" example that ships with LabVIEW (Help -> Find Examples).

Message 2 of 7
(4,036 Views)

I would like it to be just a one shot thing but I cannot get the data in the table to write I can just do the data as it collects but thats not what my team wants.

0 Kudos
Message 3 of 7
(4,033 Views)

How are you populating the table? Are you using a table indicator? Are you accumulating the data in a shift register or a Feedback Node? Or, are you using the Build Table Express VI (which internally uses a shift register). If so, whatever you're writing to the table is the same that you'd write to file. Can you post your VI?

0 Kudos
Message 4 of 7
(4,025 Views)

This is built off a tutorial that I was playing with to help me learn because when I say I am new I mean I started yesterday. I am a computer science student though though I understood the flow of the logic and things. I have a list of some of the things I need to have my final prgram do so I was just experimenting with some things here.

0 Kudos
Message 5 of 7
(4,021 Views)

Oh, dear. Express VIs galore. OK.... time for me to take a breather.... I can do this. Really, I can. Just gotta keep saying that to myself....

 

All right... You already have a Write to Measurement File Express VI in there. Does this not do what you want? If you want to write the contents of the table directly as is, then all you need to do is what I said. Have a button on the front panel, and wire that to a case structure. Inside the case structure use the Write to Spreadsheet File VI, and connect the wire that's going to the table to that VI's "2D data" input. You can provide a front panel control for the filename. The Write to Spreadsheet File will create a delimited text file which can be imported directly into Excel.

0 Kudos
Message 6 of 7
(4,009 Views)

Oh ok I understand now I did not know the had case structures. Thank you.

0 Kudos
Message 7 of 7
(4,005 Views)