LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to array

Thanks again for the prompt response. I am not sure if I understand Dennis' post. There is no Format into String in my VI. Please see attachment. What I am looking for is to extract certain bytes of data from "Data 1 from other device" and "Data 2 from other device" indicators and display them as meaningful information (like converting them to decimal and data processing, which I can do.

Thanks
0 Kudos
Message 11 of 19
(1,288 Views)
You said you wanted to modify Evan's example. But it doesn't really matter. You can modify your VI the same way I said. You are updating the strings via a Value property node. If you still want to do that instead of what Altenbach said, do the modification before writing to the property node.
0 Kudos
Message 12 of 19
(1,277 Views)
OK I took the liberty to implement my idea above and also show you where the extra processing should take place (look for an arrow ;)). I think all these references and property writes are unecessary overkill and just complicate the code.

(At the same time I stremalined a few minor things, for example (1) you index identical arrays in every single inner case... --> belongs outside the inner case structure. Instead of searching for "1" you can just search for "True" in the boolean array. I also added an event structure so the loop does not run empty cycles when no button is pressed. The event structure also gurantees that one of the buttons is TRUE (else the event would not fire!) so the "-1" case is no longer needed and the outer case structure can be eliminated entirely.)

See if this makes sense to you. 🙂
Message 13 of 19
(1,263 Views)
Pretty Cool... Thanks a lot altenbach... the program works...however, i have never used events before and never thought it was so important... now you have given me a new task... I need to learn the event structure...

Your code looks much simpler and more professional than I would have done it.. .appreciate your help.

Thanks again.
0 Kudos
Message 14 of 19
(1,250 Views)
hi altenbach,

I had a quick question regarding your code. How do I make the "collect sensor data" a continous event? In other words, I would like to collect the sensor data every 5 seconds. I would like to still keep the event structure that you provided, but just change the property of the "collect sensor data" boolean to perform data collection at every 5, 10, 15... seconds.

Thanks in advance.
0 Kudos
Message 15 of 19
(1,202 Views)
Since that button triggers the default case, you could just wire 5000 to the timeout terminal and add "timeout" to the main case as additional condition. One problem: the events will not be regularly spaced, e.g. whenever another button is pressed, the 5 second countdown starts again.

You could also add a parallel loop containing only a "Wait until next ms multiple" or a timeout event structure and then set a signaling property of the desired button at regular intervals (You cannot use latch action, thus you need to set this button to switch action, then reset it with a local variable after use).
0 Kudos
Message 16 of 19
(1,185 Views)
Hi altenbach:
 
I have tried to do what you said re: the timeout option.  I am not sure if I am getting the desired results.  The "Collect Sensor Data" still doesn't seem to collect the data every 5 seconds.  What am I doing wrong?
 
Thanks in advance.
KM
0 Kudos
Message 17 of 19
(1,018 Views)

What a resurrection of a 1.5 year old thread! 😮

Well, adding a timeout case that is basically empty won't do anything at all, right? 😉

You need to add a timeout event to the SAME event case that already handles the other communications. If this case is called by timeout, none of the buttons will be true and the search function will return a "-1". Just add a "-1" case to the small case structures and add whatever function you want (e.g. "da"). See green comments on the diagram.

RIght now the timeout resets whenever a button is pressed. You could do some timekeeping and dynamically adjust the timeout via a shift register so the timeout occurs at regular intervals (e.g. if a button is pressed after 2 seconds, set the timeout to 3000, etc.).

0 Kudos
Message 18 of 19
(991 Views)

got it... thanks a lot altenbach.

km

0 Kudos
Message 19 of 19
(921 Views)