06-23-2010 11:39 AM
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.
06-23-2010 11:43 AM
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
06-23-2010 11:48 AM - edited 06-23-2010 11:49 AM
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.
06-23-2010 11:50 AM - edited 06-23-2010 11:52 AM
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.
06-23-2010 12:09 PM
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.
06-23-2010 12:22 PM
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.
06-23-2010 12:24 PM
@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
06-29-2010 11:57 AM
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
06-30-2010 04:19 PM
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?
07-08-2010 12:08 PM
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.