LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String functions with array input - processing array of stings one function call

I’m looking for string functions which takes string array as an input and throws the array of processed stings. Has anyone come across any functions to process the array of stings by direct function call ?

 

Soemthing like this,

AdarshaPakala_0-1620025186115.png

 


We all know, we have string function in LabVIEW which takes sting input and throws the processed sting out. Let’s say we have an array of stings and each element of the array needs be processed in same manner, then the typical method is we use a for loop to achieve that. Due to processing speed limitations, I can’t use the For loop.

 

Thank you

Adarsh

0 Kudos
Message 1 of 20
(1,998 Views)

Hi Adarsha,

 


@AdarshaPakala wrote:

Let’s say we have an array of stings and each element of the array needs be processed in same manner, then the typical method is we use a for loop to achieve that.


That's the way to go: place a FOR loop around that string function!

 


@AdarshaPakala wrote:

Due to processing speed limitations, I can’t use the For loop.


You really need to explain that sentence! Which kind of limitations do you hit???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 20
(1,972 Views)

@AdarshaPakala wrote:

I’m looking for string functions which takes string array as an input and throws the array of processed stings. Has anyone come across any functions to process the array of stings by direct function call ?

 

Soemthing like this,

AdarshaPakala_0-1620025186115.png

We all know, we have string function in LabVIEW which takes sting input and throws the processed sting out. Let’s say we have an array of stings and each element of the array needs be processed in same manner, then the typical method is we use a for loop to achieve that. Due to processing speed limitations, I can’t use the For loop.


If you wrap a for loop as a sub-vi it looks like one function. 🙂 Regardless if you place the loop of it's 'built in' into a function it'll still need to iterate all those strings.
However, this function is the type that can gain lots by having a Parallelized loop.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 20
(1,948 Views)

thank for your reply!

execution time is my limitation 😊

I have more than 15000 elements in the array and I get that array for every 10mS. If I put it inside the For Loop its runs 15000 iteration per process and For Loop needs time to complete the iteration which is my limitation. I'm thinking if I could do the array operation it would be faster than looping.

 

Thank you

Adarsh

CLA from 2014

0 Kudos
Message 4 of 20
(1,922 Views)

Hi Adarsh,

 


@AdarshaPakala wrote:

I have more than 15000 elements in the array and I get that array for every 10mS. If I put it inside the For Loop its runs 15000 iteration per process and For Loop needs time to complete the iteration which is my limitation. I'm thinking if I could do the array operation it would be faster than looping.


Even when there would be a function with an array input: it would need to process the very same 15k array elements in the very same way!

The overhead of the FOR loop is next to zero for this type of application - and you can use it to parallelize that task quite easily!

(Your example of the StringSubset function suggests a quite heavy MemoryManager usage as each string will get resized, leading to quite a lot of memory (de)allcations in your loop. This might be the slow part of the execution, but not the FOR loop construct…)

 

Can you provide an example VI with some example data? Maybe we can help you with improving that string manipulation!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 20
(1,919 Views)

If the string functions are 'heavy' it might actually be faster to store the result in a Map, then you'd only do the work one time and then it's a look-up. This is of course assuming the strings are rather repetitive.

So, String in as key, look up the result. If there is none, perform the function and store for further usage.

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

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 20
(1,914 Views)

@AdarshaPakala  ha scritto:

thank for your reply!

execution time is my limitation 😊

I have more than 15000 elements in the array and I get that array for every 10mS. If I put it inside the For Loop its runs 15000 iteration per process and For Loop needs time to complete the iteration which is my limitation. I'm thinking if I could do the array operation it would be faster than looping.

 

Thank you

Adarsh

CLA from 2014


Precisely, how many new samples you get for each 10 ms acquisition time? 15000 seems to be a little too much.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 20
(1,889 Views)

Samples are between 14950 to 15000, its coming from highspeed quad USB ports.
It’s a data parsing logic. I have optimized the sting manipulation as much as possible(did not use any complex sting function, string subset, match pattern functions are used), i don’t think further optimization of parsing logic is possible.

I think if i have sting functions with array input(like MATLAB), then looping can be avoided.

Thank you
Adarsh
CLA from 2014

0 Kudos
Message 8 of 20
(1,861 Views)

Hi Adarsha,

 


@AdarshaPakala wrote:

It’s a data parsing logic. I have optimized the sting manipulation as much as possible(did not use any complex sting function, string subset, match pattern functions are used), i don’t think further optimization of parsing logic is possible.


Well, a second opinion on your optimizations might be fine, don't you think?

 


@AdarshaPakala wrote:

I think if i have sting functions with array input(like MATLAB), then looping can be avoided.


Such a function will have that loop "built in", it still has to process all of those 15k array elements!

So the "looping" is not avoided, but only hidden…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 20
(1,857 Views)

@AdarshaPakala  ha scritto:

Samples are between 14950 to 15000, its coming from highspeed quad USB ports.
It’s a data parsing logic. I have optimized the sting manipulation as much as possible(did not use any complex sting function, string subset, match pattern functions are used), i don’t think further optimization of parsing logic is possible.

I think if i have sting functions with array input(like MATLAB), then looping can be avoided.


It's a lot of data indeed.

However, the amount of parallel processing your system can do is limited (very roughly) by the number of processor cores.

Since the job is done by the processor(s), unless yours system features thousands of processors, a loop is unavoidable, although this may be hidden by the code syntax.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 10 of 20
(1,846 Views)