LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Cluster conversion

I have a string input separated with tabs and end ofl ine constants. I am trying to extract the separated items and send them to their corresponding places in a cluster. In the example code that I have provided, the first item that is extracted is a number and it is sent to the cluster number. The second item is the sting element in the cluster that is inside of the array that is insided the main cluster (i hope that makes sense). I have the first part working in my other code, but I am unable to get items to to the array in the internal cluster. Please help. You will notice that there is a straight through path for case 1 and I am thinking that this is needed in order to get into the main cluster and then deal with it as a second entitiy, therefore I have the second for loop and case structore. The string that I was testing with is: \r\t400\r\n\ttest\r\n\t. Also, if I need to I can create a separate post for thi
Download All
0 Kudos
Message 1 of 8
(4,845 Views)
Why so exceedingly complicated!!!! (You're creating fodder for the Rube Goldberg code Thread!)
 
All you need is the following (I disconnected the typdefs, so please reconnect them if needed). There are probably quite a few other easy ways to do this.
 
 
 

Message Edited by altenbach on 08-24-2007 09:08 AM

Download All
Message 2 of 8
(4,840 Views)

If you have not finished before Monday morning, check back for the Nugget that Ray and I will post on Sunday night. It may be useful.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 8
(4,824 Views)
Unlike yourself, I have not been building nor doing programming for a long time. I hate software, but I have to write it sometimes. Everytime, you answer a question, I learn a better way of doing things, than just the brute force method that I know. Thanks for the help on this. I did have one question though. How do you creat the cluster input that is in the VI you posted?
0 Kudos
Message 4 of 8
(4,813 Views)

 


@rlg50 wrote:
How do you creat the cluster input that is in the VI you posted?


Sorry, I don't know what you mean. The bundle functions always have a cluster input, so I did not have to create those.

To create the clusters for these inputs, I simply used your typedefs and disconnected them from the type definition (right-click...disconnect...). Just substitute your typedefs back and you should be good to go. 🙂

0 Kudos
Message 5 of 8
(4,813 Views)
OH, I see. That's simple. Now, I see why you said that in your previous post. Thanks once again.
0 Kudos
Message 6 of 8
(4,809 Views)
In regards to the simplification of the string to cluster program, I feel that I should not change the code which is already in place. I am simply adding to the code and do not wish to change so it. Even though as you stated, it is overly complex. One thing is, this VI is used in other places, as you could probably guess, and changing this vi will result in changes in unexpected other places. I inherited 95% of this code and I am adding some functionality. If during the process of going through everything I can revise this code to a more simple format without risking operational changes, I will definitely do so. However, since the string that is being read in here is written to a file by multiple VIs I feel that I should wait on doing such a drastic revision. With that being said, is there something simple that I am missing in my code that will enable me to bundle data into the internal cluster which I posted earlier. Also, keep in mind that there are multiple data elements (dbl, stings, etc) inside of this inner cluster that I need to extract from the string in my code. The code that I provided is in the simplest form to show the operation and syntax of the real code.

Also, is there something that I need to keep in mind in order to put the data in the correct element of the array? Thanks.

Message Edited by rlg50 on 08-24-2007 01:10 PM

0 Kudos
Message 7 of 8
(4,794 Views)
Ok, I have done some extensive coding this afternoon and with the software and have found out how to use the simplified version of the string to cluster conversion that you showed. It will still take a lot of effort, but I feel that i can do this and not have to change many things in the other VIs in order to accomidate for the change. Thanks and I'll let you know how it goes.
0 Kudos
Message 8 of 8
(4,781 Views)