취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Search for a pattern in array

해결 완료!
솔루션으로 이동

I have an array of U8 values and a string array of the pattern I want to search for:

RFeng_0-1589995672016.png

 

The string array has 5 values and the U8 array many.  I want to compare the 5 string array values against the first 5 Array u8 values (starting at index 0) if not found I want to compare the 5 string array values with 5 of the Array u8 values (starting at index 1) if not found then again compare the next 5 values of the Array u8 (index 2) etc........any help will be appreciated !

0 포인트
1/40 메시지
4,811 조회수
솔루션
승인자 RFeng
I'd use a For loop and use Get Array Subset starting at i and going to i + length (smaller array), then use an Equal? set to Compare Aggregates (a right click option). Also, you'll need to convert either the string array to a U8 array or the U8 array to a string array before starting this. I'd recommend the former as it's a smaller conversion and will take care of things like someone typing 1.0 in your string array instead of 1.
2/40 메시지
4,796 조회수

Thank You! Didn't know about Compare Aggregates.  

0 포인트
3/40 메시지
4,783 조회수

Hello, 

I'm trying to detect in 2-D Array the pattern of six followings 1 ( "111111").

If the pattern is detected in first column then my code should copy two columns ( 2 x 18) to the new subarray ( for further processing)  and start the searching process again.

I'm trying to compare two arrays but it seems that something doesn't work.

How to restart the searching process: in next portion of data will be searched next pattern of "111111" 

All new subarrays should be pushed out of loop for other calculations.

Tomasz_Poland_0-1707477676614.png

 

Tomasz_Poland_1-1707477754318.png

Thank You 

Tom

 

0 포인트
4/40 메시지
2,909 조회수

Hi Altenbach,

I'm a beginer with labview. 

I'm trying to create the code as on Your post but it seems that I'm still missing some settings.

Could You take a look on my code and give me some hints.

In the meantime I'm trying to extend this code for 2-D Array: if subarray is detected in first column then starting from the index of first the following 18 rows is taken to subarray.

Could You support me little bit with this?

Best regards

Tomasz

 

Labview 2020 / 32 bits

0 포인트
5/40 메시지
2,877 조회수

Here is a slight Modification of your code.

 

I did not touch the looplength. It is just an Idea.

Hope it helps.

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 포인트
6/40 메시지
2,851 조회수

Hi Nottilie,

Could You compile attachment to LV version 2020 32 bit or insert screnshot, please?

I have LV 2020  and it results an error:

Tomasz_Poland_0-1707758793989.png

Thank You

Tomasz

0 포인트
7/40 메시지
2,839 조회수

@Tom_wolf wrote:

I'm trying to create the code as on Your post but it seems that I'm still missing some settings.

Labview 2020 / 32 bits


I have not posted in this thread and I am not sure why you are asking me specifically. If you were trying to modify one of my programs, please give a link to the original discussion.

 

It is also not a good idea to append to a thread that is already marked as solved. The original discussion talks about an U8 array, but you have an I32 array, which is a quite different problem.

 

I think we should stick with solving the 2D array problem. Do you just want to find the first match or all matches? How should the output look like? Why is the "Pattern a 2D array if we are only interested in a 1D pattern? All your control terminals belong before the loop, of course.

 

When attaching code it also really helps if the controls contain typical default values. Empty arrays are probably not typical.

 

 

0 포인트
8/40 메시지
2,808 조회수

@nottilie wrote:

Here is a slight Modification of your code..


(code in LabVIEW 2024 that most don't have. Make sure to use "save for previous" before attaching)

 

It is a really (really!) bad idea to attach modified code with the same filename as something that has been posted earlier. You need to give it a new name!

0 포인트
9/40 메시지
2,806 조회수

See if this can give you some ideas....

 

 

altenbach_0-1707789414709.png

 

 

10/40 메시지
2,796 조회수