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: 

Sorting array based on topic name

Solved!
Go to solution

I have two data sets being continuously streamed through an mqtt server, RX topic and RX message. I need my final output to be a 1x22 array the RX message and the corresponding RX topic (22 channels)

 

here is what i have no far. It works for checking if the topic name is the corresponding channel, then outputs the corresponding mesasage.

 

My question is there definitely has to be a better way to do this than pasting the same loop 22 times and then building the final array

 

Thanks

0 Kudos
Message 1 of 4
(2,275 Views)

By pasting 22 times you mean the only thing changing in the loop is the string equal going along a pattern like this

 

daq/1/ -> daq/2/ -> .... -> daq/21/ -? daq/22/

 

And that's how you'd get all 22 channels by just changing that 1 number in each loop?

0 Kudos
Message 2 of 4
(2,258 Views)
Solution
Accepted by topic author arob

I'm guessing you are looking for something like this SubVI. Note that the input array has be initialized (i.e. have size 22), as well as the array with channel names.

 

snip.png

Message 3 of 4
(2,252 Views)

yes perfect thanks

0 Kudos
Message 4 of 4
(2,220 Views)