02-24-2015 01:21 PM - last edited on 10-26-2015 04:40 PM by LiliMcDonald
I have this VI I am trying to make generate axis (X, Y, Z) based on which sensor I pick. For example, If I pick sensor 1 the axis will be x1, y1, z1. Sensor 2: x2, y2, z2. Now based on the axis, I have a listbox that has the axis of the sensor selected. you can pick more than one sensor. If you select sensor one, the value for x in the listbox is 0, and 1 for Y and so on. but if you select sensor 2, the value for x y z is the same as the ones for sensor 1. I understand why but I just want to change that so when I pick :
Sensor 1:
x= 0
y=1
z=2
sensor 2:
x=3
y=4
z=5
sensor 1 and 2
x1=0
y1=1
z1=2
x2=3
y2=4
z2=5
and so on
Please help. I hope I was clear. The Vi is attached
Admin Note - VIs removed per user's request.
02-24-2015 02:07 PM
First, there is a vi missing so the supplied vi will not run.
It's not entirely clear what you are looking for. Are you needing the contents of the Listbox to change depending on what sensor is selected? A property node will do that but as you are only using the values in the listbox to index a couple array's, there are probably better ways to do it.
It would appear that perhaps the missing vi is acquiring a list of channel names from an ini file. Why not use trhe same ini file to contain the values needed to index the array's. Then when you select a sensor, it simply reads the correct section from the ini file.
That is a guess but it's not really clear what you are trying to accomplish.
02-24-2015 02:41 PM - last edited on 10-26-2015 04:40 PM by LiliMcDonald
My apologies. here's the missing Vi. I like your suggestion, I didnt not wanna complicate the file itself.
Admin Note - VIs removed per user's request.
02-25-2015 06:58 AM
Still another subvi required to run but at this point, I don't think I need to run it.
Configuration files are your friends. Any time you have a lot of values that can change based on a selection, I use ini files. While purists might say an app should only have a single ini file, I will use multiple ini's to better organize my input variables. So it is completely resonable to have one ini file for your channels, another for your coordinates and so on. By doing this, you won't have to have a front panel object though it would be useful to have an indicator for the initial debugging.
Simply read the needed values from the config file into an array and feed into your For loop.
Also, for good practice coding, add your error wires to force linear flow.
02-26-2015 10:31 AM - edited 02-26-2015 10:38 AM
+1 on using ini files for configuration....
not truly understanding how information is received and outputed. I 've attempted an example that might help...manipulate as needed.
02-27-2015 09:06 AM - last edited on 10-26-2015 04:40 PM by LiliMcDonald
Thanks for the replying but what I am looking for is when I select sensor 2 the index for M2X, M2Y, M2Z should be 3, 4, 5 not 0, 1, 2. your way would not be compatible to the rest of my software. Now in the code, Array 6 does the job. but when I select more than one sensor that creates a problem. It'll only display the axis of the last sensor selected. see for yourself.
here are all the files.
Admin Note - VIs removed per user's request.
02-27-2015 12:40 PM
as i said...modify as necessary. its an example to help you understand how to pull data from an array. you need to learn how to use a for loop and autoindexing to pull the data you need from your 2D string array.goto the many tutorials offered. good luck!
02-27-2015 12:42 PM
Need to clarify one thing before I can make a more detailed suggestion. Do you highlight all the required sensors and then click GO? (Boolean Ctrl)
Can you post a txt file that has the values required based on the sensor(s) selected?
I can provide a good example if I have this
02-27-2015 01:13 PM
No boolean control whatsoever. As I select the sensor, it automatically gives the axis for the sensor(s) that you pick. I dont have a text file that set the values for the axis or sensors. the sensor names were entered in the list box manually. There values go from 0 to 11 respectively. The axis names, if you followo the code, comes from the config file, no values just the array of names. if you select sensor 1 and it takes the first 3 names in the array (0, 1, 2) . the values for those axes in the axis listbox is 0 1 2. if you select sensor 2 it gives you the second set of 3 names in the array (3,4,5) but the axis values in the axis listbox is 0, 1, 2 because it's only 3 names in the axis listbox. I want the axis to be 3, 4, 5 instead. so if I select sensor 3, it'll take 3 names from the array of names starting from index 6 to 8.
then display in the axis listbox. the values for each item in the listbox should start from 6, 7,8 as well in order for me to grab the right data. the whole is to match each axis to the right data.
02-27-2015 03:55 PM
Please post the missing vi ConfigFileDmass.vi