LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using string array to select single value

I hope it's just me, but it seems that LV makes some rudimentary tasks rather difficult.
 
Here is my problem;
I need to set-up a series of commands to a GPIB device in a table/matrix/array and select each individual command by row and column.
 
I also need to be able to edit these commands at will from the front panel.
 
The goal overall is to remove the tedium of operator set-up as there is about 96 commands that must be exercised each time the operator
runs the application. As you can imagine this would be a difficult task for the operator to manage manually. If automated to call each command
sequentially (however not always in order) then I believe that it would make for a much more accurate set-up.
 
This is a relatively easy thing to do in other languages. Is it really so difficult in LV or am I just looking in the wrong places?
 
I have tried using tables, matices, and arrays with no luck. Closest to success was with the Table. However when I defined the row and column
that I desired, it still returned everything in the table????????????
 
Any help or suggestions would be appreciated.
 
Thanks in advance
 
Phil
0 Kudos
Message 1 of 9
(3,778 Views)

I have some problem visualizing exactly what you are doing. Can you attach a small example program?

How does the operator select from the commands? how does the operator define the order?

To get an element out of an array or table, you would use "index array".  How are you getting the entire table by mistake?

0 Kudos
Message 2 of 9
(3,776 Views)
Thanks for responding Altenbach,
 
Sorry for not being completely clear first time around but I was running between tasks.
 
Consider this:   I need to send commands to a GPIB device one command sequence at a time.
 
EXAMPLE:  'A08E' is the 'string' command to be sent to the device, this may be followed by another command say 'A05E'
so let's say that I have a list of commands to choose from and I will be sending six sequential commands to set-up my device and
then reading my data. Then I will set-up for my next data read with another six (maybe different) commands.
 
May table may contain data like this (comma delimited):
 
X1  A07E, A05E,A
 
I tried building a table to enter my commands into one cell per command. Then by indexing through the table, I would like to retrieve each command and send it to the device
one command at a time (for simplicity).
 
When I change the table index, to say row 1, column 1, I was expecting to get the command located within that cell only. But instead, what I am getting is everything from that cell
position and beyond.
 
I am sure that the function that I desire will work if I can increment the indexer from a pair of 'for loops' and capture only 1 cell of data to pass to my device in each instance.
 
 
0 Kudos
Message 3 of 9
(3,757 Views)
Thanks for responding Altenbach,
 
Sorry for not being completely clear first time around but I was running between tasks.
 
Consider this:   I need to send commands to a GPIB device one command sequence at a time.
 
EXAMPLE:  'A08E' is the 'string' command to be sent to the device, this may be followed by another command say 'A05E'
so let's say that I have a list of commands to choose from and I will be sending six sequential commands to set-up my device and
then reading my data. Then I will set-up for my next data read with another six (maybe different) commands.
 
May table may contain data like this (comma delimited):
 
X1   A07E, A05E,A
 
I tried building a table to enter my commands into one cell per command. Then by indexing through the table, I would like to retrieve each command and send it to the device
one command at a time (for simplicity).
 
When I change the table index, to say row 1, column 1, I was expecting to get the command located within that cell only. But instead, what I am getting is everything from that cell
position and beyond.
 
I am sure that the function that I desire will work if I can increment the indexer from a pair of 'for loops' and capture only 1 cell of data to pass to my device in each instance.
 
 
0 Kudos
Message 4 of 9
(3,756 Views)
Thanks for responding Altenbach,
 
Sorry for not being completely clear first time around but I was running between tasks.
 
Consider this:   I need to send commands to a GPIB device one command sequence at a time.
 
EXAMPLE:  'A08E' is the 'string' command to be sent to the device, this may be followed by another command say 'A05E'
so let's say that I have a list of commands to choose from and I will be sending six sequential commands to set-up my device and
then reading my data. Then I will set-up for my next data read with another six (maybe different) commands.
 
May table may contain data like this (comma delimited):
 
X1    A07E, A05E,A
 
I tried building a table to enter my commands into one cell per command. Then by indexing through the table, I would like to retrieve each command and send it to the device
one command at a time (for simplicity).
 
When I change the table index, to say row 1, column 1, I was expecting to get the command located within that cell only. But instead, what I am getting is everything from that cell
position and beyond.
 
I am sure that the function that I desire will work if I can increment the indexer from a pair of 'for loops' and capture only 1 cell of data to pass to my device in each instance.
 
 
0 Kudos
Message 5 of 9
(3,756 Views)
Thanks for responding Altenbach,
 
Sorry for not being completely clear first time around but I was running between tasks.
 
Consider this:   I need to send commands to a GPIB device one command sequence at a time.
 
EXAMPLE:  'A08E' is the 'string' command to be sent to the device, this may be followed by another command say 'A05E'
so let's say that I have a list of commands to choose from and I will be sending six sequential commands to set-up my device and
then reading my data. Then I will set-up for my next data read with another six (maybe different) commands.
 
May table may contain data like this (comma delimited):
 
X1     A07E, A05E,A
 
I tried building a table to enter my commands into one cell per command. Then by indexing through the table, I would like to retrieve each command and send it to the device
one command at a time (for simplicity).
 
When I change the table index, to say row 1, column 1, I was expecting to get the command located within that cell only. But instead, what I am getting is everything from that cell
position and beyond.
 
I am sure that the function that I desire will work if I can increment the indexer from a pair of 'for loops' and capture only 1 cell of data to pass to my device in each instance.
 
 
0 Kudos
Message 6 of 9
(3,756 Views)
THAT WAS INTERESTING................GUESS I NEED TO WATCH WHAT KEYS I'M HITTING.........SORRY FOR THAT!
 
Thanks for responding Altenbach,
 
Sorry for not being completely clear first time around but I was running between tasks.
 
Consider this:   I need to send commands to a GPIB device one command sequence at a time.
 
EXAMPLE:  'A08E' is the 'string' command to be sent to the device, this may be followed by another command say 'A05E'
so let's say that I have a list of commands to choose from and I will be sending six sequential commands to set-up my device and
then reading my data. Then I will set-up for my next data read with another six (maybe different) commands.
 
My table may contain data like this (comma delimited):
 
            Y0      Y1      Y2      Y3.............
X0     A07E, A08E, A47E, A50E,
X1     A07E, A05E, A01E, A51E,
X2     A08E, A47E, A50E, A51E,
 
In my mind, by incrementing my x index and y index, I should be able to go to that cell location right?
 
EXAMPLE:     X1Y1 would give me 'A05E'....right?
 
I tried building a table to enter my commands into one cell per command. Then by indexing through the table, I would like to retrieve each command and send it to the device
one command at a time (for simplicity).
 
When I change the table index, to say row 1, column 1, I was expecting to get the command located within that cell only. But instead, what I am getting is everything from that cell
position and beyond.
 
What I get from X1Y1 is 'A05E,A01E,A51E,A08E,A47E,A50E, A51E'..........NOT what I was looking for.
 
I am sure that the function that I desire will work if I can increment the indexer from a pair of 'for loops' and capture only 1 cell of data to pass to my device in each instance.
 
I guess my limited time working with Labview is starting to show, but I have coded pretty extensively in other languages, so I think my approach is correct.
 
I don't have my example vi as I deleted it out of frustration. It wasn't working anyway!
 
I appreciate your time in trying to help. Thank you!
 
Phil
 
 
0 Kudos
Message 7 of 9
(3,753 Views)
Could it be you are using "array subset" instead of "index array"?
0 Kudos
Message 8 of 9
(3,745 Views)
Thank you again!
 
After having spent so much time trying to get an array to accept string values without success, I had abandoned that idea to try a table.
I was having little luck there as well but after much communication and help from other users as yourself, I think my problem is solved (maybe).
I did not realize that I could drop a 'string constant' into an 'array constant' to convert the value type. I have since done that and I have succeeded
in building a single dimensional array that increments my commands to the GPIB device.
 
Now all I have to figure out is how to make it work in a 2 dimensional array and I think I'll be all set.
 
I've crossed the major stumbling block thanks to all of you guys.
 
Thanks a heap for all your help!
0 Kudos
Message 9 of 9
(3,735 Views)