LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for a pattern in array

Solved!
Go to solution

Hi Tom,

 


@Tom_wolf wrote:

There should be Decrement instead of increment otherwise we lost first two rows ( there is TTTT instead of TTTTTT)


As your description isn't very clear I searched for a row of "ALL TRUE" ant took the following 18 rows…

You can adapt the suggestion to your requirements.

 


@Tom_wolf wrote:

My improvements are:

- eliminate Loop For - only one loop

- elimination array transposition function but adding array subset + index array. This will give me that all subsets are separated to the Matched Found Array.


  • Right now your VI takes ~1min to analyze an array of 60 entries because of the 1s wait in the loop.
  • Your "appended array" only contains 2 rows, so it doesn't make sense to take a subset of 18 rows.
  • The whole code before "appended array" belongs before the loop.
  • The loop should stop once you find a match because otherwise you overwrite your "Matched Array" with other or even empty data…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 31 of 40
(415 Views)

Hi Tom,

 

some improvements:

There are more improvements possible as you don't need to convert from integer to boolean arrays…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
0 Kudos
Message 32 of 40
(408 Views)

Hi GerdW,

I have to separate from incoming data stream messages - each new message is marked with "TTTTTT" 

This we already did.

The timer with 1500 ms is only for observing data flow. Normally will be removed from code.

 

Tom_wolf_0-1709797582881.png

 

On each separated message ( 18 x 2) I have to do following cycles:

1. concatenate rows 9, 10, 11,12 and 14,15,16,17 from first column  --> in example below is 00000001

2. transform concatenated address (ID BIN = 00000001) to ID HEX (01)  or ID DEC (1) 

3. concatenate from 2nd column the rows 7 to 18 ( value 000000000000) 

4. transform value from BIN to DEC - this is a value from slow channel associated to the address ID DEC =1.

5. repeat for next coming message.

 

Tom_wolf_3-1709798412800.png

 

 

Best regards

Tom

 

0 Kudos
Message 33 of 40
(402 Views)

Hi Tom,

 


@Tom_wolf wrote:

On each separated message ( 18 x 2) I have to do following cycles:

1. concatenate rows 9, 10, 11,12 and 14,15,16,17 from first column  --> in example below is 00000001

2. transform concatenated address (ID BIN = 00000001) to ID HEX (01)  or ID DEC (1) 

3. concatenate from 2nd column the rows 7 to 18 ( value 000000000000) 

4. transform value from BIN to DEC - this is a value from slow channel associated to the address ID DEC =1.


  1. Get ArraySubset starting at 9th element and get 9 elements. Then remove the 5th element from this subset using DeleteFromArray.
  2. Use BooleanArrayToNumber. The representation for your frontpanel (hex or dec) is irrelevant in the block diagram.
  3. Again use ArraySubset on the 2nd row.
  4. Again use BooleanArrayToNumber...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 34 of 40
(399 Views)

Hi GerdW

Below is my code after several improvements and tests.

  • I decided to take for searching "TTTTTT" only "1st bit decode" 1D-Array instead of searching in whole 2-D Array
  • Each "matched found array" will be overwritten by the next coming but I don't need to store ( until now) all array - I need only ID and relating to this ID value ( traceability portion, temperature portion, error code portion etc). 

 

I will implement it tomorrow to the global application and check how it works

Tom_wolf_0-1709828699880.png

Best regards

Tom

0 Kudos
Message 35 of 40
(378 Views)

Hi Gerd, 

Could You also give me some hints how to perform similar operation with fast channel data, please.

Taking into consideration simplifying done with slow data, I guess that You will do this with 3 elements 

I do it now in the following sequence:

(mathematical below)

Tom_wolf_0-1709830663586.png

and my Labview code: 🙄

 

Tom_wolf_1-1709830857254.png

Best Regards

Tom

0 Kudos
Message 36 of 40
(373 Views)

Hi Tom,

 

when dealing with integer numbers then you should not use pink strings or orange floats!

 

These are ALL I32 values…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 37 of 40
(367 Views)

Hi Gerd,

This really very good solution. I must learn more about this operations, with masks, AND algebra etc.

Below is my code to calculate Fast Channel data. Input data stream from FPGA is U32. I inverted this to I64 because sometimes value is 3233716994 and I32 offers range only from -2147483648 to +2147483648.

 

Tom_wolf_0-1709899958568.png

I will check it on global application soon.

Until now no problems detetcted.

Let me know Your comments.

 

Best regards

Tom

0 Kudos
Message 38 of 40
(337 Views)

Hi Tom,

 


@Tom_wolf wrote:

 

Below is my code to calculate Fast Channel data. Input data stream from FPGA is U32. I inverted this to I64 because …

I will check it on global application soon.

Until now no problems detetcted.


  • There is a typo in the array constant to "reverse" the F2 value.
  • You could also use U32 instead of I64…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 39 of 40
(322 Views)

Hi Gerd,

 

  • There is a typo in the array constant to "reverse" the F2 value.
    • yes, right. Thanks for noticing
  • You could also use U32 instead of I64…
    • Yes, it works also. 

I created subVI from "artefact" generated last week.

I'm testing now and works well.

Thank You for support.

0 Kudos
Message 40 of 40
(294 Views)