From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variably Change a 2-D Array name

Solved!
Go to solution

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

0 Kudos
Message 1 of 7
(2,541 Views)

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>

0 Kudos
Message 2 of 7
(2,533 Views)

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

0 Kudos
Message 3 of 7
(2,514 Views)

Something like this:

XML Replace.png

0 Kudos
Message 4 of 7
(2,504 Views)

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

0 Kudos
Message 5 of 7
(2,494 Views)
Solution
Accepted by dlovell

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.

Message 6 of 7
(2,489 Views)

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

0 Kudos
Message 7 of 7
(2,477 Views)