LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Customized Array, Loop and Merge...

Greetings,

                I have a problem when I run this VI for the second time... I am not getting the answer I intend to get... I think the problem is the append function... What else can I do to get my intended answer????

Let me explain what I'm trying to achieve:

                         Main and Main 2 are a single dimension array whereas A and B are 2 dimensional... I would like to compare the Main and Main 2 row-wise and if Main is greater I would like to take the same row from A and if Main 2 is greater the row of B should be written... This must be done 5 times in one run... When run for the second time I would like to have only 5 rows in the Final Array... But I get 10 due to append but I'm not sure how to achieve this without append...

Front.jpg

True.jpg

False.jpg

   

 

I have attached the vi also.

Thank you in advance...

0 Kudos
Message 1 of 4
(415 Views)

Your feedback node is uninitialized hence it will retain the data from the previous execution.

Add an empty array to the Initializer Terminal.

 

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 4
(404 Views)

The main problem is that your code is way too complicated because you have not learned auto-indexing yet.

 

Here's the same functionality:

 

altenbach_0-1711983040354.png

 

(Now the number of iteration will be determined by the shortest array. No need to wired N. You would need to use index array if one of the arrays is short and you want to pad with zeroes if it runs out of elements, but in that case, N should be determine e.g. by the largest array in the indexing dimension. If the sizes are large than 5 and you only want five rows in the output, you can just wire N again.).

 

 


@Archer_Longleaf wrote:

... if Main is greater I would like to take the same row from A and if Main 2 is greater the row of B should be written. ..


You are not defining what should happen if the two values are equal. Currently it would write B in that case.

Message 3 of 4
(349 Views)

Thank you very much... I did not think about auto indexing...I will try to learn about it.... Thank you for the idea...

0 Kudos
Message 4 of 4
(306 Views)