LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read a txt file, display a table of values, select a value to set min value for DAQMX

Hello everyone, I am having trouble with the following data importing. I want to do the following:

Open a txt file, have it be imported as a table. Allow the user in the GUI to select a value on the 2nd column, set that value as either min or max for a daqmx analog output. I'll attach the .txt file being used. I can add the code but I was basically using the read from text.vi example with no luck.

 

 

0 Kudos
Message 1 of 10
(4,912 Views)

Instead of read from .txt file, how about Read From Spreadsheet File.

It is located in Programming >> File I/O

This will output a 2D array of your data, then you can index the second column

Cory K
0 Kudos
Message 2 of 10
(4,905 Views)

And use the Table's Edit Postiion property. It can be used directly with the Index Array function to get the value. It will be up to you to write code that will reject a selection from the wrong column.

Message 3 of 10
(4,901 Views)

Cory is right. But from there, you'll have to know what the user clicks on in order to select it from the array. Consider populating that 2nd row data into Listbox, using the Item Names property.

 

Edit: Dennis posted while I was typing, and has described how to do it with a Table or Array. What I like about the Listbox is that when you click on an item, it highlights. Either way is basically preference.

Richard






Message 4 of 10
(4,893 Views)

Please see the attached VI.

Note: You will need a little extra logic to determine if that value was selected out of the 2nd column.

At the moment, the program doesnt care where the user clicks, as long as it is in the array.

Cory K
0 Kudos
Message 5 of 10
(4,877 Views)

Thank you all for your quick posts, I am working on a solution hopefully. In the last post unfortunately I was unable to open the example vi because I am using version 8.2 of LabView.

 

Thanks,

DB.

0 Kudos
Message 6 of 10
(4,872 Views)

 


@dbrittain wrote:

Thank you all for your quick posts, I am working on a solution hopefully. In the last post unfortunately I was unable to open the example vi because I am using version 8.2 of LabView.

 

Thanks,

DB.


Here you go in 8.2

 

Cory K
Message 7 of 10
(4,868 Views)

Thank you all, I have set up this input but I have a couple more questions. First now that I have the ability to have a mouse click to set a value, is it possible to have two events, such that the first sets a certain value and the second retains a different one?

 

In addition (im not sure if this would be ok to post here but for the sake of clarity and decluttering the forum I shall post it here) is it possible to switch from a constant voltage mode (in DAQMX analog output) to a waveform mode ( attacthed the binary waveform) all while maintaining a constant min value (untill updated from the table by user, which is also attached).

 

I have attachted a vi (Labview version 8.2) that I threw together today.

 

 

Thank you all,

DB

Download All
0 Kudos
Message 8 of 10
(4,802 Views)

You can absolutely add more events to detect another mouse click. The LabVIEW help offers some great instructions on how to accomplish this.You can add the code you want to run to retain a value in the second event case.

 

As for changing the switching the mode of the DAQ, can you be a little bit more specific? I don't understand what you mean by switch from a constant voltage mode to a waveform mode. Are you attempting to do this in the DAQmx Create Channel VI?

Stephanie A.
Americas Marketing Manager
National Instruments
0 Kudos
Message 9 of 10
(4,768 Views)

In terms of switching 'modes' what I mean is in mode A there is a single value voltage output in the DAQ vi whereas in the 'waveform mode' (Mode B) there is a user selected binary file that is read as a waveform and then output to the analog out.

 

My question is how can I have a user driven switch to go between each modes while keeping the minimum value constant? (IE if the user selects 2V in the constant mode, and then switches to the waveform mode, the min value for the Analog Out would be 2V whereas the max value is then selected from the mouse driven events as mention previously in this thread.

 

My last question is how is it possible to have two 'Mouse Down' events without on interacting or interfering with the other. I want to select two values from a table, I got it to work for one. But I want it to alternate, for example, the user first selects the min value from the table then the next click (Mouse Down) selects the max value, then the next click would return to the min value again.

 

Thank you all for your help,

DB.

0 Kudos
Message 10 of 10
(4,655 Views)