03-15-2022 07:55 AM
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
Solved! Go to Solution.
03-15-2022 08:13 AM
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.
03-15-2022 08:51 AM
My string is looking like this and if necessary it can be slightly changed.
03-15-2022 09:10 AM
@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.
03-15-2022 09:11 AM - edited 03-15-2022 09:12 AM
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.
03-15-2022 12:16 PM
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
03-15-2022 12:34 PM
@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.
03-15-2022 01:12 PM
@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.
03-15-2022 01:30 PM
@paul_cardinale wrote:
A cluster is brown instead of magenta if all the elements are the same type.
Not so:
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.