LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

insert elements of an array into an existing array

I need to add data to an array where each row represents a month (1-12) and each column represents a day (1-30ish). some data may occur on the same day and same month and needs to added and then inserted into the relevant cell. For example if two pieces of data are both produced on day 4 of month 5 they need to be added together and added to any data already in the cell of the spreadsheet and then replace it.

below the first example is what I want except that where data occurs on the same day of the same month it does not add, it simply shows one or the other.
The second example shows what I am trying to achieve but I have a bit of a loop where the data just itterates instead of adding once.

Please hel
p, been stuck on this for days.
Download All
0 Kudos
Message 1 of 3
(2,581 Views)
I'm not sure if you want the resulting array to only hold the range of months/days that you have data for or if it's OK with an array for the whole year?

In the attached example I've just created a 2D array to hold the whole year, filled it with NaN constants (you could use zeroes instead if that's more convenient for you) and then I use the month and day as indexes to check and replace.

- If the cell at the given indexes alreeady have a value (not equal to NaN in this case) I add it with the new value and replace the cell value.
0 Kudos
Message 2 of 3
(2,581 Views)
Thanks so much for your help, that is just what I wanted my vi to do!
0 Kudos
Message 3 of 3
(2,581 Views)