09-17-2014 05:19 AM
Hello,
i have a string with 8 fields divided with a separator. For example:
C|text|20140910-132435|1|A|0,000|0,000|3
Currently i use "MatchPattern" to split this string into the fields.
For 200.000 loops it akes ~1sec
Can this be done faster?
Thanks
Solved! Go to Solution.
09-17-2014 05:37 AM
Maybe simpler would be to use spreadsheet string to array with '|' as delimiter. Array type 1D-array of strings.
I wouldn't expect this method to be faster, though.
09-17-2014 06:01 AM
Thanks. I tested it but ist 0.4sec slower against MatchPattern.
09-17-2014 06:56 AM
I've modified your timing setp up slightly.
There's no need to subtract and update the indicator 20k times.
09-17-2014 07:09 AM
If your format is never going to change, I like the Scan From String.
09-17-2014 08:02 AM
I can only open Vi´s Labview 2013 😞
How to set the format-string for ScanFromString? %s|%s|%s|%u|%s|%f|%f|%u is not working, how do i set the separator here?
Thanks
09-17-2014 09:32 AM
Use "[^|]" for the strings. That will give you a string up to (but not including) the |.
09-17-2014 10:07 AM
2013 Version
09-17-2014 10:53 AM - edited 09-17-2014 10:56 AM
Simply moving the string to number conversions outside the loop reduced time by a factor of 3 on my system (280ms for your code to 90ms). I had to replace the scan from string to fract/exp string to number, but the string functions will take arrays and output arrays.
EDIT: I also moved the timing calculation to a frame after the for loop to remove the needless update of the indicator for my numbers above.
09-17-2014 10:55 AM
Are you also making use of parrallel for loops?