NI Home > Community > NI Discussion Forums
Reply
Member
dlovell
Posts: 33
0 Kudos
Accepted Solution

Variably Change a 2-D Array name

Hi Everyone,

So I have this VI that I had created and someone on here helped vamp it up big time. Thanks again for that. I have run into a snag with my program. So I have this VI that takes in arrays and places them in an xml file. I am using teststand to control a SigGen, PowerMeter, and a switch matrix so I can take a whole bunch of array measurements and place them into a singke xml file. My problem is that my xml file (when the test is completed) will have about 200 or more arrays in it. So I was hoping that I could make the 2-D array name into a variable so I can make each array unique in my xml file. That way I can eventually create another VI that takes the xml file and display the desired array. Does anyone know how to make the 2-D array name into a variable so I can change it to what I want from teststand? My VI is attached below.

 

Thanks,

dlovell

Active Participant
Taki1999
Posts: 420
0 Kudos

Re: Variably Change a 2-D Array name

I think post-processing the output from the Flatten to XML may be your best bet.

 

Do a Search and Replace on

<Array>
<Name>2D-Array</Name>

 

and replace with

<Array>

<Name>variable name</Name>

Member
dlovell
Posts: 33
0 Kudos

Re: Variably Change a 2-D Array name

Hey,

Thanks for the quick response. Do you mean replace by hand when the xml file is completed? I don't fully understand, I am new to this xml format...

 

Thanks,

dlovell

Active Participant
Taki1999
Posts: 420
0 Kudos

Re: Variably Change a 2-D Array name

Something like this:

XML Replace.png

Member
dlovell
Posts: 33
0 Kudos

Re: Variably Change a 2-D Array name

Hey Taki,

So I understand now where you are coming from. Did your VI (the picture you posted) work? I can't get the 2D-Array to change to my Var_Name (my input name)... Below is my VI that I made look like your picture.

 

Thanks,

dlovell

Active Participant
Taki1999
Posts: 420

Re: Variably Change a 2-D Array name

I didn't actually test the previously posted version.

 

I think my inputs to the search function aren't right.

The newline seems to be screwing it up.

 

Try using

<Name>2D-Array</Name>

for the search string

and

<Name>%s</Name>\n

as the Scan into String Function.

 

I did test a subset of this and it worked for me.

Member
dlovell
Posts: 33
0 Kudos

Re: Variably Change a 2-D Array name

THANKS Taki!!!!! This was exaculty what I was looking for!!