LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to optimize the for loop structure

 
40/5000
 
通用场景demo.pngdemo.png
 

Are there any other methods besides the for loop that can achieve the same function? Please, experts, could you give me some more guidance?

0 Kudos
Message 1 of 6
(152 Views)

The loops generate the data.

The data goes directly into the indicator and the headers are properties of the table.

FillTable.pngFillTable.png

0 Kudos
Message 2 of 6
(133 Views)

NO NO NO,We have omitted the instrument control part. The program flowchart is merely a simplified version. In fact, it represents the results collected by the instrument.

0 Kudos
Message 3 of 6
(126 Views)

I thought writing the headers only once is an optimization instead of writing every header cell 12 times. I obviously misunderstood your problem.

 

What is the issue with the loops?

What do you want to optimize? Execution speed? Memory?

0 Kudos
Message 4 of 6
(104 Views)

@留白 wrote:

NO NO NO,We have omitted the instrument control part. The program flowchart is merely a simplified version. In fact, it represents the results collected by the instrument.


Unless you the instrument data arrives slowly one element at a time, all this occurs in the inner loop and you want to update with each new value, you should write all values at once after the loop. I recommend to define the full problem in more detail. Having all these property nodes inside inner loops is not efficient.

 

Also note that your sequence structure is not needed because order does not matter. Since your program updates the values, the tabel should be an indicator, NOT a control! (If it is a control, the user could randomly enter new values at runtime! Please vote for this idea!!!!!)

 

Here's what I would do.(If the headers are always integers, they should be blue of course!)

 

altenbach_0-1787328976407.pngaltenbach_0-1787328976407.png

 

altenbach_1-1787329042143.pngaltenbach_1-1787329042143.png

 

 

0 Kudos
Message 5 of 6
(44 Views)

@altenbach wrote:
Unless you the instrument data arrives slowly one element at a time, all this occurs in the inner loop and you want to update with each new value, you should write all values at once after the loop. I recommend to define the full problem in more detail. Having all these property nodes inside inner loops is not efficient.

To slowly update one element at a time, here's what I would do. Of course you can modify to e.g. update an entire row or column at once.

 

altenbach_0-1787329945190.pngaltenbach_0-1787329945190.png

 

0 Kudos
Message 6 of 6
(39 Views)