LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to accumulate data in array?

Solved!
Go to solution

I made a program aimed to simulate the intensity of light when many light bulbs are put together. I have intensity data of one bulb in xls.-files. So, I want to program to work as follows.

 

  1. Open the xls.-file and get the data.
  2. Put the data into different positions. I put one data set (one bulb) in each excel sheet. //: This is to simulate putting the bulb in different places.
  3. Sum the data in the same cell across the different sheets.

 

My problem is this program running too slow. How should I improve this program? I have an idea to make a big array and accumulate data in that array. However, I do not know how to do it. I can only use [Insert Into Array Function] and [Replace Array Subset Function], which are not suitable for my purposes.

 

Please accept my apologies for any unclear explanation because I am a real beginner. I would sincerely appreciate all your comments, suggestions, and hints. Thank you in advance.

Download All
0 Kudos
Message 1 of 6
(290 Views)

Here is the updated program.

0 Kudos
Message 2 of 6
(283 Views)

Hello PuriK,

 

Could you please provide a .xls file with some data to simulate ?

 

One question to start :

-Why doing two "New report" actions ? That could fit into a unique flow.

 

0 Kudos
Message 3 of 6
(253 Views)

Thank you for your comments. I improved my program by using only one "New report" action. Please see the updated program attached here.

 

I also attached the .xls file here.

 

Thank you again for your help. I am looking forward to your response.

Download All
0 Kudos
Message 4 of 6
(172 Views)
Solution
Accepted by PuriK.

Hello PuriK,

 

To avoid race condition I've put the Excel add worksheet into your main report.

I've tested with 20 for the number of LED and it generates 400 sheets (I guess it works as expected).

LED_Pitch_custom.png

 

Now if I follow your orignal post you would like to sum data from SheetX cell A1 with SheetY cell A1 and so on...

 

You could do it by reading all Excel sheet and then add arrays but it does not seem a good idea to me.

 

An other way is to generate 3D array in LabVIEW by generating 2D arrays of lenght X + number of LED by width Y + number of LED. Then you fill the holes with zeroes and sum up 2D arrays.

Here below something I tried, it can be optimized for sure, but please look if it fits your need.

 

LED_Pitch_custom_Varray.png

Message 5 of 6
(148 Views)

Hello Defaphe,

 

Thank you again for your help. It saves me!

According to your ideas, I use them to improve my program.
Here is the final program. It works fast and effectively.

 

I truly appreciate your help!

 

LED pitch 20220113_5.jpg

 

0 Kudos
Message 6 of 6
(107 Views)