LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing elements


@Nghtcrwlr wrote:

Ok.. sorry for the complications.  Array A is actually the replacement elements. If Array A has three elements, then last three elements of the Input Array have to be replaced by these. If 4, then last 4 lements. and so on...

 


So why are you autoindexing on array A. Simply calculate the size difference and find the index where the replacement should start. No loops needed.

0 Kudos
Message 11 of 16
(550 Views)

OK, let's start over.

 

We have two arrays:

A=[66,77]

B=[5,0,1,1,5651,77,5797]

 

How should the output array look like every time it is written to the database:

 

First write...

Second write....

...

Last write ...

0 Kudos
Message 12 of 16
(539 Views)

Lets say we have  two arrays:

A=[66,77,88,99]

B=[5,0,1,1,5651,14,5797]

 

Output should be

First write : [5,0,1,1,5651,14,66]

 

Second write: [5,0,1,1,5651,77,66]

 

Third write: [5,0,1,1,88,77,66]

 

Fourth write: [5,0,1,99,88,77,66]

 


 

Cameron wrote:

You're making it unnecessarily complicated (and, as altenbach says, it won't work). Just take your replacement array and use Replace Array Subset to stick it into your original array with an offset of 1 element. All done.


 

I just donot want to use replace array subset because i need to write it to database for each time the outer Loop runs.

 

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 13 of 16
(515 Views)

Maybe this is what you need

 

BR

Vincent

 

temp.png

 

 

0 Kudos
Message 14 of 16
(506 Views)

Hi everyone

 

Using Shift Register (as suggested altenbach) is required if you want to upgrade your output table each time you execute your For Loop. 

In the For Loop you also can add a SubVI which save your output table in your MySQL Database. I suggest you to use error handling as well.

 

Have a good day.

Capture.PNG

 

 

Certified LabVIEW Architect (CLA)
0 Kudos
Message 15 of 16
(490 Views)

@Nghtcrwlr wrote:

Lets say we have  two arrays:

A=[66,77,88,99]

B=[5,0,1,1,5651,14,5797]

 

Output should be

First write : [5,0,1,1,5651,14,66]

 

Second write: [5,0,1,1,5651,77,66]

 

Third write: [5,0,1,1,88,77,66]

 

Fourth write: [5,0,1,99,88,77,66] 


See, now you are making more sense. Until now the problem description was pure gibberish and you kepy everybody guessing. 😉


@Nghtcrwlr wrote:

I just donot want to use replace array subset because i need to write it to database for each time the outer Loop runs. 


What does using a certain primitive have to do with how you are using the output later. I don't understand your argument at all. You need to use the function that gives the correct desired output. Period. 😮

0 Kudos
Message 16 of 16
(477 Views)