LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to combine 2 strings into 1

Hello all,

 

Here I have a question about data processing. Now with a UDP open and UDP read vi I keep

 

receiving UDP messages with different titles (for example $1, $2, $3....) from 2 devices. The 2

 

devices are almost syncronized and send UDP messages at almost the same time (less than

 

one second of difference in time). With a Obtain notifier vi I can receive these messages one by

 

one and send them to another loop. Now what I want to do is to receive these messages TWO

 

BY TWO! Becasuse they are from 2 devices, firstly two $1 messages, then two $2 messages

 

and so on. I'd like that the obtain notifier could receive messages two by two, namely the messages

 

with the same title could be received together! I can't use a concatenate string because the received

 

messages will accumulate. So what should I do, any idea?

 

Chao

0 Kudos
Message 1 of 18
(4,903 Views)

Actually I don't need to combine all messages with all titles two by two, only the message with title $1

 

because that's the only type of message I'm interested.

0 Kudos
Message 2 of 18
(4,897 Views)

If you use a common queue instead, both devices can feed the same queue, and then can be dequeued in your other loop.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 18
(4,890 Views)

Sure you can use concatenate string.  I assume when you say "messages can accumulate", you are talking about storing the string in a shift register.  You can also use a select statement to determine when to store the string in a shift register or store an empty string in the shift register.

 

It is difficult to give any advice without seeing the code that you have now.

0 Kudos
Message 4 of 18
(4,889 Views)

@RavensFan wrote:

Sure you can use concatenate string.  I assume when you say "messages can accumulate", you are talking about storing the string in a shift register.  You can also use a select statement to determine when to store the string in a shift register or store an empty string in the shift register.

 

It is difficult to give any advice without seeing the code that you have now.


Hmmm... your solution is so different than mine.  Maybe I misunderstood the question?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 18
(4,886 Views)

I agree that you probably really want to use a queue.  This way you know you are not overwritting messages.  But we really need to see some code to understand properly what you have.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 18
(4,875 Views)

Thanks for the reply!

 

here is a simplied vi of my code. I tried to put a concatenate string at the place

 

where I put 'here' to do the combination but nothing changed. The Num of message

 

shows still 2 messages instead of one when 2 messages with title '$ES' come together.

 

So do you have further suggestion?

0 Kudos
Message 7 of 18
(4,873 Views)

Sorry my post above with my code is for you. But anyway that's my code and what

 

I want to say as comments. So any suggestion?

0 Kudos
Message 8 of 18
(4,872 Views)

Thanks for the suggestion. But as far as I know, the queue function works similar to notifier, right?

 

And in my code above, do you have any idea how could I use queue and dequeue? Shall they have

 

the same scheme as the notifier has?

0 Kudos
Message 9 of 18
(4,867 Views)

Example_VI_BD.png

first of all ...i would get rid of that "stop/abort" vi? and use a local stop control for the second loop and change the control mechanical action to "switch when pressed"

 

 

 

 

0 Kudos
Message 10 of 18
(4,862 Views)