03-13-2009 11:15 AM
I am creating a vi which has to set up 24 channels of instrumentation with five different values for each channel. I need to pass these values as variables to other stages of the vi.
Is there a way to have the same basic variable name with a channel appended and then during the course of looping through all the channels address this variable with one object whose name changes on each loop.
For example, I create InstrumentNameCh0 through InstrumentNameCh23 as variables, is there a way for the loop to output to InstrumentNameCh"i" where "i" is the loop count.
Otherwise, I have to create 24 parallel structures differening only by name.
03-13-2009 11:37 AM - edited 03-13-2009 11:38 AM
A "format Into String" node inside a For loop will meet the specs you have specified.
Ben
03-13-2009 11:43 AM
wildcatherder wrote:For example, I create InstrumentNameCh0 through InstrumentNameCh23 as variables, is there a way for the loop to output to InstrumentNameCh"i" where "i" is the loop count.
I guess I don't quite understand what you mean by "variable" in this context. Can you attach a small example VI?
03-13-2009 12:58 PM
03-13-2009 01:09 PM
wildcatherder wrote:
That is an excellent way to CREATE the local variable name but I need to reference (write to or read from) an already created local variable name in a loop with a different name on each pass. I don't see how the technique you describe could be used for that purpose.
Now I am baffled (nless you are trying to access a value by passing its name).
Please post an image of what you said you know how to do but would require a lot of duplication. With that we may be better able to help out.
Ben
03-13-2009 01:23 PM
03-13-2009 01:34 PM
So while we are waiting for clarification....
An Action Engine With acton like
Init - Accepts an array of the names and optionally the initital values. There should be a 1-to-1 relation between the names and the values. Store ths in a SR
Set Value - This action accepts a string and a numeric. The string is used by a serach 1d aray from the names soter in the SR. If the index is value do a replace array subset for the value. Update the SR
Get_Value - This action is similar to above but it indexes out the value for the SR and returns same to the caller.
Ben
03-13-2009 01:41 PM
03-13-2009 02:33 PM - edited 03-13-2009 02:34 PM
Thanks Matt!
Don't know if it is getting close to the original query or not. Here is an image to go with my pvious outline for the AE.
Ben
03-13-2009 02:50 PM
Case structure would work but would still require me to write in each case. I am trying to to read and write to front panel displays by means of local variables. The variables are named similarly for all 24 channels with the channel number appended to the "base name". I would like to loop through these channels, performing various string/data conversions, by making the local variable name itself some kind of variable.
Thanks