LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting string with changing length length

Solved!
Go to solution

Hi,

I am trying to read the position of an automatic stage in X,Y,Z axes. The stage returns a string of the three axes, and I would like to get the position of each axis separately. The thing is that the length of the string changes as the stage moves, so I cannot simply split at a predetermined offset.

Any help will be appreciated,

Gaby 

0 Kudos
Message 1 of 8
(3,799 Views)

Under String -> Additional String Functions you'll find "Search/split string" which sounds like a solution to me. I'm assuming you have a space or comma between the values by which you can split the string.

 

/Yamaeda

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 8
(3,798 Views)

Thanks for the quick reply. But it doesn't really help, since the as the stage moves (e.g from the 0 0 0 position to the 100 -100 200 position) the length of the string changes and with it the place from which the scan should begin.

   

0 Kudos
Message 3 of 8
(3,792 Views)

Check this idea, it's a small loop that looks for spaces and cuts the string at those locations, while building an array of the values.

 

the end result should be a value-array with your x,y,z-values.

 

(i hope, i'm no pro at this) 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 8
(3,787 Views)

The Search function also gives the index where it found the character, which is reused by the shift register to know where to look the 2nd time around ...

 

*update*

 

Some quick testing shows my inital version is suboptimal (though functions, strangly enough). Since i send the "cut down" version of the string to the shift register you'll always start looking at position 0.

 

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 8
(3,779 Views)

Thanks for the Vi, but I have I don't have Labview 8.2.  Could you please save it in Labview 8.0.

Thanks again,

Gaby

0 Kudos
Message 6 of 8
(3,778 Views)
Solution
Accepted by topic author gshemer
I hope this is what you're looking for. 🙂
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 8
(3,775 Views)

There is an easier way.  Use the Spreadsheet String to Array primitive to do it in one node.  No loops required.  This primitive (and its inverse) is useful any time you have a token separated string to parse in a regular fashion.

 

Spreadsheet String to Array parsing 

Message Edited by DFGray on 11-25-2008 07:41 AM
Download All
Message 8 of 8
(3,725 Views)