LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for a pattern in array

Solved!
Go to solution

Dear Altenbach

 

I absolutely agree not to attach with LV 2024 and not renaming the file.

 

Sorry it was my fault. But as you already made a fine solution I will not downconvert and upload a slightly differnt version.

This would make the tread even more confusing.

 

 

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 11 of 40
(452 Views)

Hi Altenbach,

You have right. I made some confussion with my posts.

I asked to You because I saw, that You offered solution in this thread.

Let me apologize for this chaos from my side.

Thank You for support. I will test solution and back to discussion.

I will be more clear in future.

 

best regards 

Tom

 

 

0 Kudos
Message 12 of 40
(444 Views)

Hello Again,

I'm still struggling with my labVIEW code.

After several transformation data from sensor (messages collected in "Input Array" )  I have to separate each 18 following frames if in the first 6 rows is 1. Thanks to the help of Altenbach I started exercises with provided code.

Unfortunately I stuck again.

 

 

Tom_wolf_0-1709495094388.png

 

 How to restart For Loop and search in next array rows?

I would like to not stop with conditional terminal but skip of 18 rows at "Array to search" and restart searching to capture next message which starts with following "111111". 

Tom_wolf_1-1709495484769.png

I was trying to use shift registers, feedback nodes, case structures but up to now without good result.

Array subset will be used to other simple calculations.

I attached VI with Input array data ( Made current values as default)

Could You suggest something?

Thank You

Best regards

 

 

0 Kudos
Message 13 of 40
(410 Views)

Hi Tom,

 


@Tom_wolf wrote:

 How to restart For Loop and search in next array rows?

Tom_wolf_1-1709495484769.png


To "restart" the FOR loop you need to place a loop around the shown code: with the next iteration of that loop your FOR loop will be restarted...

 

  • What's the point of that Select node inside your loop? It's pure Rube-Goldberg!
  • What's the point of the "AND TRUE" function? It's pure Rube-Goldberg!
  • Why do you show the loop index inside the loop? Most likely you will only see the last index after the loop has finished...
  • The shift register of your loop is not initialized: is this "by design decision"?
Best regards,
GerdW


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

Hi GerdW

 

  • What's the point of that Select node inside your loop? It's pure Rube-Goldberg!
    • It' is deposit of some my combinations with For Loop controls - to remove
  • What's the point of the "AND TRUE" function? It's pure Rube-Goldberg!
    • It' is deposit of some my combinations with For Loop controls - to remove
  • Why do you show the loop index inside the loop? Most likely you will only see the last index after the loop has finished
    • I was trying to observe at which step For Loop is stopping
  • The shift register of your loop is not initialized: is this "by design decision"?
    • I was trying to manipulate Boolean variable "Pattern detected" before releasing it to others controls 

Below is screenshot from cleaned VI. I also attached VI with accompanying input data.

Tom_wolf_0-1709538240686.png

I'm wondering how to "cutting out" continuously arrays like as "found match" from flowing data ?

I'm aware also that "Array to search " can not rise to infinity - shall be cleared somehow to avoid overfilling, for example after reaching  (100 x 18)  rows.

Could You give me some suggestions?

 

Best regards

Tom

 

0 Kudos
Message 15 of 40
(383 Views)

Hi Tom,

 


@Tom_wolf wrote:

Below is screenshot from cleaned VI. I also attached VI with accompanying input data.

 

I'm wondering how to "cutting out" continuously arrays like as "found match" from flowing data ?

I'm aware also that "Array to search " can not rise to infinity - shall be cleared somehow to avoid overfilling, for example after reaching  (100 x 18)  rows.

Could You give me some suggestions?


Well, a "cleaned" VI with lots of bended wires… 🙂

 

  • The first FOR loop belongs before the While loop: you don't need to parse the same string array again and again.
  • There SURELY is an easier way to parse an array of strings containing numbers then
    building an array of strings to convert to decimal number array to pick the first (and only?) element of the array to convert to hex-formatted string to pick the first char to convert back to numeric to convert to binary-formatted string to pick the 1st and 2nd char and convert both to numeric values
  • Please switch off the lables of the LabVIEW functions: when you really need to know their names then you should use the context help window!
  • "Array to search" will contain 54 rows as this is the iteration limit of your FOR loop! Why do you want to limit to "100×18 rows"???
Best regards,
GerdW


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

Hi Gerd,

Content of first For Loop is algorithm to get Information from Message from Sensor which is decoded in SENT (SAE J2716 SENT) - Slow Channel Portion. It's a long story...

Now I have to collect 18 following messages and go throw number 216017185 ( for example) to single bit (0/1).

If six following bits  are :  1 1 1 1 1 1 - it means new message arrived - this is identification. Then from rest 12 bits I have to build data reference and corresponding data. Then from following portions of numbers I have to concatenate full information. 

 

Tom_wolf_0-1709563733888.png

 

The data which arrives from array ( String) is form bigger system and flows continously and very fast. 

This small application which I build is only to exercise potential solutions - how to capture ( cout out from data stream each 18 messages ( 6 x 11111 - which mean start of new frame + 12 bits of data).

I prefer to work with small sub-programs in order to verify how it could work and then I'm transferring as sub-VI or raw code to bigger application.

 

It's like enigma😥.

 

Could You support me with efficient capturing this data ( I mean selecting 18 rows if first 6 rows = 1), please?

 

Best regards

Tom

0 Kudos
Message 17 of 40
(383 Views)

Hi Gerd, 

there is my solution.

The upper table is implementation in Excel, and below is LV code according to Your hints.

I used 54 as N-Terminal input value because there are 3 x 18 messages - to make exercises.

Timers to improve observations.

Now I must move it to global application. 

Let me know Your comments.

 

 

Tom_wolf_0-1709585689289.png

Best Regards

Tom

0 Kudos
Message 18 of 40
(370 Views)

Hi Tom,

 


@Tom_wolf wrote:

Now I have to collect 18 following messages and go throw number 216017185 ( for example) to single bit (0/1).

Tom_wolf_0-1709563733888.png


See this:

No loop, just some simple math, only 1 (ONE!) conversion from string to numeric…

Best regards,
GerdW


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

Hi Gerd,

Brilliant! 

Simple and functional!

 

One question- How to change display of  second bit:

To have 0100 instead of _100? 

 

Tom_wolf_0-1709641304697.png

 

best regards

Tom

0 Kudos
Message 20 of 40
(341 Views)