03-18-2010 05:26 PM
The attached VI should accept the two numbers, seperated by commas, and then use the first number to set a boolean in an array. Then the next number should set the corresponding array location with the value.
For example,for an array of 5 elements:
User input is 3, 2. The VI would produce the following two arrays:
F 0
F 0
T 2
F 0
F 0
Solved! Go to Solution.
03-18-2010 07:01 PM - edited 03-18-2010 07:02 PM
Separated
When you post your VI, please save it with some typical data saved into the controls as defaults so we can run it right a way, and truly understand how your input data is formatted.
Take a look at this.
03-19-2010 10:54 AM
Cool, Thanks for the help and I'll do a better job of detailing my posts.
The picture you posted worked but only for one set of values. I want to sort a set of values that will change everytime I call this VI.
So a set of values will be:
One call to the VI may have:
3,2
4,1
8.4
Another call may have:
1,3
2,2
Another call may have:
1,1
Another call may have:
1,2
4,1
5,2
6,3
etc....
I have updated my VI and have gotten close but I can't seem to capture the value after the comma in the array of numerics. I hope I am explaining myself enough?
03-19-2010 11:06 AM - edited 03-19-2010 11:06 AM
You can use RavensFan's code exactly how it is.
Just change one little thing.
Where he has the 'row IDs....', instead of a string, you will have an array of strings.
Put the rest of the code, except for that input inside of a For loop.
When you pass the array into the For loop, it will run RavensFan's code and change all of the necessary elements.
03-19-2010 11:25 AM
03-19-2010 11:27 AM
03-19-2010 12:08 PM
You actually said user input is 3,2. You never said anything about having multple combinations of these.
Post what you have done so far.
03-19-2010 12:35 PM
03-19-2010 01:26 PM
I have attached an update to the VI and did what Cory recommended.
Yes, my first post did not provide enough info, I am trying to rectify that here.
The purpose of the VI is to assign a boolean value to a series of valves. These are rotary valves and require a pulse (1 then 0) to turn them to the next position. Some valves have 4 positions, some have 3, and some have 6 positions. I am using compact fieldpoint to interface to the valves. So, I want to send a TRUE to the cFP channel that is connected to one rotary valve then also send a number of positions to turn. Hence, the boolean and numeric array of clusters that this VI will produce. Yes, the final version will combine the two arrays into a cluster inside an array... an array of clusters.
The valve or "row of ID's" text box will vary. I have a total of 8 valves and a maximum of 6 positions. Again some valves have only 3 positions, some valves have 6 positions, etc....
So, sending a 3,2 will ultimately wind up as rotary valve 3 turn to position 2. A 4,1 will signify that valve 4 should be pulsed 1 time. A 1,6 shall turn valve 1 six times.
The user will input the string, (i.e. 3,2 4,1 8,5) and the valves 3, 4, and 8 should turn their respective position after the comma.
03-19-2010 01:37 PM
I'll add something else, my thought is that if I can get the two arrays to line up then I can run the two arrays in a for loop or while loop and if a TRUE value is seen then all I have to do is find the numeric value in the same location in the numeric array and that is how many pulses I send to the valve.
boolean array Number array
3,2
F 0
F 0
T 2
F 0
F 0
etc...
4,2 5,1
F 0
F 0
F 0
T 2
T 1
F 0
etc....