From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loop subtraction between two arrays

Solved!
Go to solution

Im pretty bad at wording this so bare with me. I have a 1D array of eight values, and another 1D array of lets say 800 values. i would like to subtract the first element of the first array from the first 100 elements of the second array, then the second element of the first array from elements 100-200 of the second array, third element first array from elements 200-300, and so on... I am trying to do it now with a for loop but i cant quite get it

 

i would ultimately like an output 1D array of all the 800 values, just with the new values after subtraction. 

 

Anyone have advice for hwo to wire this to a loop?

 

I know its hard to understand, especially without a picture or VI but theres a lot of other stuff going on in my VI that would just pose more confusion for anyone that opened it. 

 

Help is appreciated!!

0 Kudos
Message 1 of 16
(3,920 Views)

Seems simple enough. What have you tried?

0 Kudos
Message 2 of 16
(3,915 Views)

Maybe like this? There are millions of ways to do this.

 

 

0 Kudos
Message 3 of 16
(3,909 Views)

Not exactly, I tried pulling an index from the array of eight and incrementing the value by one and wanted the loop to perform it for each incremented value, but i dont know how to specify i want each increment to do a specific set of 100 values, i also cant figure out how to build a 1D array of all the values following eachother.

 

I tried the one you posted, not exactly what im looking for, not sure if its because i was trying to execute it without waveforms and just values, but it still gave me a 2D array and wasnt outputting all of the values

0 Kudos
Message 4 of 16
(3,890 Views)
The output terminal is in concatenate mode. If your LabVIEW version is ancient, you might need to reshape instead.
0 Kudos
Message 5 of 16
(3,883 Views)

No i have labview 14 so thats not the problem. Actually trying to recreate what youve shown, I cant even attach my arrays the way you did; when connecting the array of 8 i get an error: wire connected to an output terminal

0 Kudos
Message 6 of 16
(3,872 Views)

Im really just looking for a way to simply do this in a loop, just trying to avoid having to pull eight seperate indices out as individual elements and send each of those through a seperate subarray and so on and so on im still pretty new to labview so i could do what i need to do with a lot of coding, just trying to learn new functions that can save me time and space

0 Kudos
Message 7 of 16
(3,865 Views)
If you get errors, you have made a mistake. Please attach your via instead of keeping us guessing.
0 Kudos
Message 8 of 16
(3,852 Views)

@libbyherself wrote:

I cant even attach my arrays the way you did; when connecting the array of 8 i get an error: wire connected to an output terminal


A wire can only have exactly one data source. I generate fake data and use indicators to display them. In your case you would delete the data generation on the left and change the indicators to controls (right-click...change to control).

0 Kudos
Message 9 of 16
(3,834 Views)

Here's another possibility, same result.

 

 

0 Kudos
Message 10 of 16
(3,823 Views)