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

Urgent : Array Comparison

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

Hello, I need some urgent help if possible.

I'm fairly new to Labview but I do have a certain basics.

I'm trying to accomplish the following.

 

I have 2 arrays of the same size.

I'm comparing the elements of the first array to a certain value.

If some of the elements fits this requirement I want the compare the corresponding elements in the second array to another value.

If the elements of this second array are indeed greater then this new value I want to switch a boolean output to yes.

 

EXAMPLE!

 

Array1 =

1 2 6

5 4 9

3 7 2

 

Elements of Array1 > 5 ?

x x 6

x x 9

x 7 x

 

Array2 =

6 4 1

6 5 7

9 8 3

 

I only want to use the elements at the position corresponding to the elements from array1 that were greater then 5.

All other elements can be ignored.

 

New Array2 =

x x 1

x x 7

x 8 x

 

Elements of Array2 > 6 ?

x x x

x x 7

x 8 x

 

If Answer = 0 : Boolean = false

In this case : Answer = 2 elements : Boolean -> True

 

I could really use some help.

Any idea is welcome.

 

Thank you in advance.

0 포인트
1/7 메시지
3,884 조회수
솔루션
승인자 KLI

I would make both array comparisons.  You'd wind up with two arrays of boolean values.  Then AND those arrays together.  Now you have an array of booleans where a True means the element in the first array met condition 1 and the same element in the second array met condition 2.

0 포인트
2/7 메시지
3,881 조회수

Nice Idea !

I will test this.

 

But how to know the positions in the arrays of these elements now?

 

 

0 포인트
3/7 메시지
3,874 조회수

I am not sure I full understood but I threw this together really quick.

 

Seems to do what you wanted but it's ugly and I am sure there are better ways...

========================
=== Engineer Ambiguously ===
========================
0 포인트
4/7 메시지
3,870 조회수

There are many ways to do this.

  • Do you really need to know the positions? If you just need to know of a TRUE exists in the output, do an "OR array elements". If the output is true, at least one element is true.
  • Use "boolean to 0,1" followed by "add array elements". The value will tell how many elements are true.
  • You could use two stacked FOR loops and build an array of the TRUE indices of the final array in a shift register.
  • You could reshape the 2D array to a 1D array, use search 1D array in a loop to find all TRUEs (here is example code that could be adapted)
0 포인트
5/7 메시지
3,863 조회수

 


@RTSLVU wrote:

I am not sure I full understood but I threw this together really quick.

 

Seems to do what you wanted but it's ugly and I am sure there are better ways...


I responded to your duplicate thread and assumed single dimension arrays, so ignore my response.

 

 

========================
=== Engineer Ambiguously ===
========================
0 포인트
6/7 메시지
3,837 조회수

: Thank You

0 포인트
7/7 메시지
3,812 조회수