LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Split from String and Graph

Solved!
Go to solution

Hello,

 

I am working in LabVIEW 13. I am receiving a string from a robot in this format: "[X,Y,Z],"   where X,Y,Z are numbers that can vary in character count. I am wanting to split these strings into 3 seperate doubles with just the numeric values (i.e. omit the brackets and commas), and then graph the error between the commanded position data vs the returned position data. I have looked at the search/replace and split string vi's, but I am kind of confused on how to use them properly...

 

Can someone help point me in the right direction to first split the strings and then graph the numbers?


Thanks,

SM

0 Kudos
Message 1 of 6
(3,148 Views)
Solution
Accepted by topic author Sman29

Graphing, I think you can figure out by playing around a bit with the numbers. To get you started, here is how you would use Scan From String to get the 3 numbers:

Scan From String.png

 

If you are just graphing the error between actual and theoretical, that's easy. Get the difference in XYZ between the two points, then perform a Pythagorean theorem calculation on the resulting vector.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 6
(3,145 Views)

Hi SM,

 

use ScanFromStrng with format string "[%f,%f,%f]"!

 

Edit: James was faster and also made a snippet for you…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(3,144 Views)

Works excellent! Thanks guys!

 

Now that that part is done, how can I graph these 3 numbers vs the numbers I send the robot? In other words graph the error/discrepency between the 2. I have been looking at the Plot Multi-XY but I can't figure out how to get the data into it correctly, I am confused on how to go from dobule to cluster to all the other data types it needs...

 

EDIT: Also I should note, that these strings are coming from the robot 4 times a second, so it's a constant update.

 

Thanks,

SM

0 Kudos
Message 4 of 6
(3,139 Views)

Show us what you've tried so far. If you only care about the error, and not the direction in which the error is, then just generate a single error value (DBL) using the method I described above. If you need to plot 3 axes, that will be a bit more difficult.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 6
(3,126 Views)

Guys, thanks for all the help. I got it all figured out and it works how I need it to.

 

Attached is a snippet of my code and what my waveform looks like.

 

Thanks again!

SM

Download All
0 Kudos
Message 6 of 6
(3,105 Views)