LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to cluster

Solved!
Go to solution

Hello

 

First of all i want to say that i have been trying to find " Learn Labview basics- 5. Data structures" (someone in other forum topic referred to that) and i couldnt find those lessons.

Iam receiving data through serial port and reasing them with Visa read and output of visa read is string and in that string there is 12 numbers from sensors that i want to put in cluster and be able to label each number and then unbundle cluster by name to acces those numbers one by one, but i cant figure out how. If you can, please try to explain it or navigate me how can i learn about this problem.

 

Thank you

0 Kudos
Message 1 of 9
(2,337 Views)

What exactly does your string look like?  It is really hard to know how to convert something without knowing what the structure is in the first place.


GCentral
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 2 of 9
(2,329 Views)

My string is looking like this and if necessary it can be slightly changed.

0 Kudos
Message 3 of 9
(2,318 Views)

@enjoyer_1 wrote:

My string is looking like this and if necessary it can be slightly changed.


Amazing.  Instead of just copying the string to the clipboard, and pasting it into your post (which would have been more useful), you go to the extra trouble of getting a screen grab, saving it, and uploading it to your post.  Now anyone who might want to help you would have to manually transcribe the string (which of course means a lot fewer people will be willing to help you)*.

On top of that, your code is messy.  It's not a big deal in this case because the code is tiny.  But, in general, if you want people to help you (with anything, in any field), you'll be more likely to get help if you don't present a mess.

 

*My cow-orkers are like that; they expend an extra effort that makes it harder for others.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 4 of 9
(2,311 Views)
Solution
Accepted by topic author enjoyer_1

So this is coming from a microcontroller that you have control over?  If that is the case...

1. Remove the "MPU1:" and "MPU2:" from the string.

2. Remove the spaces around the commas.

3. You missed a comma between the third and fourth value for each MPU.

 

So if you follow this advice, you should have something like "-132.00,64.00,15520.00,221.00,14.00,13.00,560.00,-100.00,-18020.00,-116.00,-286.00,-202.00", and of course end with a termination character, preferably a Line Feed (\n, 0xA).  Then you can use the Spreadsheet String To Array to convert to a 1D array of values followed by a Type Cast to convert that into your cluster.  The cluster can be wired directly to the chart.


GCentral
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 5 of 9
(2,310 Views)

Thank you i understand everything but i cant figure out what did you put as "type" in type cast, brown colour suggests that it is waveform but i tried to put waveform there and it was obviously not correct data type 

0 Kudos
Message 6 of 9
(2,261 Views)
Solution
Accepted by topic author enjoyer_1

@enjoyer_1 wrote:

Thank you i understand everything but i cant figure out what did you put as "type" in type cast, brown colour suggests that it is waveform but i tried to put waveform there and it was obviously not correct data type 


It is actually a cluster with 12 values in it, each value properly named.


GCentral
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 7 of 9
(2,255 Views)

@enjoyer_1 wrote:

Thank you i understand everything but i cant figure out what did you put as "type" in type cast, brown colour suggests that it is waveform but i tried to put waveform there and it was obviously not correct data type 


A cluster is brown instead of magenta if all the elements are the same type.

Double-click on the cluster constant to expand/collapse.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 9
(2,246 Views)

@paul_cardinale wrote:

 

A cluster is brown instead of magenta if all the elements are the same type.

 


Not so:

Kyle97330_0-1647368834694.png

A cluster is brown if it's completely numeric (with no arrays).  It's that way because it has a fixed data size and you can do math operations on it.  But you can mix and match which numerics you use.

0 Kudos
Message 9 of 9
(2,241 Views)