LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter string data in an array faster.

Solved!
Go to solution

Dear all ,

kindly go through the attached file and let me know is there any alternate solution other than attached one to filter data as faster as possible. because i have 20000 lines to filter so its taking more time,please do suggest.

Thanks in advanceSmiley Wink

0 Kudos
Message 1 of 14
(6,909 Views)

Hi muniraj,

 

it really would help to answer your question if you would provide some meaningful example data and explain the kind of filtering you want to apply…

 

How long does it take with your VI to actually do the filtering of your 20k lines of text?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 14
(6,874 Views)

Two changes you can do:

- use Match Regular Expression instead of Match Pattern: prepending a ^ to Expected Type, you will only get a match when Expected Type is at the beginning of the input string (you spare the comparison with a+bb).

- only drop the colon when needed: enclose this code in a Case Structure

There may be other suggestions but, as GerdW pointed out, we need to know what's the logic behind the code: it looks odd that you need to process every pair of subsequent strings (0,1),(1,2),(2,3)... instead of (0,1),(2,3),(4,5)... which is at a first glance more natural.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 14
(6,866 Views)

Maybe you can reorder the Data array so that data of the same type can be found in consecutive indexes and you can stop the search operation suddenly if the type is "higher" than the Expected Type

0 Kudos
Message 4 of 14
(6,864 Views)

I assume that you that you want to check if the beginning of each string matches the "Expected Type" string. Then try this one:

 

grafik.png

Your usage of "Index Array" suggests that only every second element of "Data" has to be tested. Is that correct?

Regards, Jens

Kudos are welcome...
0 Kudos
Message 5 of 14
(6,854 Views)
  • Your code seems flawed overall, because you are indexing outside the array on the first iteration (there is no index=-1).
  • You are always looking at consecutive elements, so autoindexing on the array and using a shift register for the i-1 element would eliminate the double indexing.
  • As has been said "filtering" can mean many things. Provide some typical data and the expected result. (easiest would be to load some typical data into the controls (a couple dozen elements, for example) and make the current value default before attaching. Also please set the index of the array container to zero.
  • I can think of several better ways to do the string operations, but let's wait until you clarify what you want. (Example: compare the offset past match with the string size of the "expected type")
  • You only need to do the processing and trimming of the "c" output if the equal comparison is true. You are doing it always, even if most of the time the output is discarded a nanosecond later. (not sure if the compiler will see that and optimize the code accordingly behind the scenes).
0 Kudos
Message 6 of 14
(6,847 Views)

Dear all kindly refer the following attached file which I'm expecting.

 

Thanks in advance

 

0 Kudos
Message 7 of 14
(6,841 Views)

Hi

Please find attached for my expectations.

0 Kudos
Message 8 of 14
(6,836 Views)

Please attach the actual VI containing these as default values. Do you really expect us to read and type characters from a picture???

0 Kudos
Message 9 of 14
(6,822 Views)
Solution
Accepted by topic author Muniraju

Hi muniraj,

 

atleast less code:

check.png

Best regards,
GerdW


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