LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to array

Hi all,

I am using LabView 7.1 and trying to send different Hex commands to read different data from another PC using TCP/IP VIs. I am also using the TCP VIs to control the other PC.

I created a big while loop with an array of commands that is indexed each time a button is invoked. I am not able to display the output in different indicators. Any help is appreciated. Please see the attached image of my vi.
0 Kudos
Message 1 of 19
(4,495 Views)
I am not sure if this is exactly what you want but I suggest using the value property.

I created the data indicators I wanted and then depending on the enum value I send out that reference. You could also create an array of references and index it depending on your VI.

As a side note: Is there a reason you have 2 while loops? I am assuming you just where cutting your code down for us.
0 Kudos
Message 2 of 19
(4,473 Views)
Thanks for the prompt response. I am not sure if I understand your code. What I am looking for is separate indicators for each output I receive from the other PC via TCP/IP.

For instance, when I write 6F64(Hex), I get an output... I want to display that in one indicator...when I write 5461(hex) I get another output, which i want to display in a separate indicator.. and so on..

This process continues till I hit the stop button to exit the while loop. In other words, the output out of the "6F64" indicator updates everytime a new value is acquired as the iteration continues.

I hope that makes it more clear... i wish i could explain it better...

Thanks again in advance for any help.
0 Kudos
Message 3 of 19
(4,468 Views)
Instead on just one indicator, you could use an array of indicators. Use the iteration terminal, i, to index the proper element when writing to the array using Insert Into Array funtion. You can display the entire array by expanding the array indicator on your front panel.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 19
(4,461 Views)
Here is another version that does basically the same thing. If this is not what you are looking for can you attach the code you took the picture of, maybe by looking at the other cases I can understand what you are trying to do.

Anyway all I did was create an indicator for each of the commands (in my VI just 6F64, 5461 ,6F74, and 6F70)

I then created an array of all their refernces, and I just set the value of that specific indicator when that is the command I sent. By indexing the indicator array the same way you are indexing the command array I can set the result to the correct indicator.

So in my example you can see that the indicator that coresponds to the command being sent gets updated, and the others stay the same. So as you change the enum the correct indicator gets updated.

Becuase I am not sure what is in the other cases, I am not sure if this will completely work. You may have to do some searching in addition.
Message 5 of 19
(4,443 Views)
If you want to send some output to a different indicator depending on some variable, use a multi-case structure with one indicator in each case. (See attached example). Each indicator will retain the last value written to it.

Message Edited by altenbach on 03-07-2005 12:05 PM

Message 6 of 19
(4,435 Views)
Thanks a lot everyone.. i tried all the 3 versions posted in this thread.. tbob, evan and altenbach.. i kinda mixed all 3 of them and got the end result.. appreciate your responses.
0 Kudos
Message 7 of 19
(4,424 Views)
Hi,

I forgot to post this question earlier...

In the TCP%20Commands[1].vi provided by Evan, I want to be able to extract the output strings and do more data processing on it. In my case, the output stings are in Hex format and i want to be able to extract certain bytes and display them as meaningful readings. But this VI wont let me do that 'cos the output string is an indicator and I cannot wire an indicator to the input of any string manipulation functions...

Any suggestions?

Thanks
0 Kudos
Message 8 of 19
(4,396 Views)
Of course you can. The way I would recomend is that you stick your string manipulation between the Format Into String and the Value property node. Or, use another Value property set to read or use a local variable.
0 Kudos
Message 9 of 19
(4,383 Views)
Don't wire to the indicator, but to the wire going to the indicator. 🙂 It is probably much easier if you would use my simple method with the case structure instead of all these ineficient property writes.

Why don't you attach your VI and I'll have a look.
0 Kudos
Message 10 of 19
(4,381 Views)