LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create list of combination

I'm trying to create a combination list of elements in 2D array (see Pic1).

I also despise (erase) those combinations with an empty element.

 

I've made a vi that generates all the combination (without to erase the combinations with empty elements) but I think it's very inefficient because when the dimension of the array is greater than 11x4 (11 rows and 4 columns) LabVIEW crash (Full memory).

 

Some idea to improve the vi?

 

 

 

Vicens

LV10 / WinXP

Download All
0 Kudos
Message 1 of 13
(4,323 Views)

Hi Vicens,

 

- 4 columns and 11 rows give you 4^11 combinations: ~4 million combinations of 11 strings, each string using it's own memory. Yes, that can hurt...

- Why not include the test for empty elements in the building phase instead of filtering the whole array afterwards?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(4,313 Views)

Hello,

 

I know that this is a very old thread, but i had the same requirement as the first post. I had developed the code in excel using vba (or macro). I did so before finding this thread and it so happens that your advice, i.e.

 

"Why not include the test for empty elements in the building phase instead of filtering the whole array afterwards"

 

i had already incorporated into the code.

 

I had been introduced to labview a while back, and have been very happy to use the same. So for the fun of it i implemented the same logic in LV to get oh more used to labview,

 

how ever i found a startling difference in the amount of time taken to get the outputs from the 2 platforms.

 

number of output rows LV Execution time in ms macro execution time in ms
72 10 101
288 37 136
576 38 152
1728 84 148
5184 226 417
20736 2476 957
62208 37817 2812
124416 111705 6000

 

 

Surprisingly “LABVIEW” was “SLOWER”, waaaaay slower, now I want to understand both platforms better.

 

would any 1 care to explain why...?

if yes so i would be happy post both the codes .....

 

 

ps: ive got way too much time on my hands....

0 Kudos
Message 3 of 13
(4,148 Views)

Hi abhinandan,

 

care to explain WHAT?

 

Could you care to attach all the code used to get those timings?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(4,133 Views)

With pleasure

 

1)

 

unzip and open the list of combinations.vi,

(LV2013 has been used)

 

set the control "set to 1000 for debug mode" to 1000 and run the vi,

this would give you an over view of the logic used (in about 2 to 3 minutes)

 

you could use the lv debug mode, but it would take longer.

 

it is set to give you an output of 72 rows. 

 

the settings or the column contents and the number of possibilities in each column of the output array are defined in the "master settings sheet.csv" in the support folder

 

2)

 

open the macro enabled workbook "master setting sheet.xlsm"in the support folder

 

run (debug first) the macro "prepare_table" 

 

*the sheet "setting"contains the same definitions 

*the TEST sheet will contain the output

*to debug the macro, press edit instead of run and use F8 key for step by step debugging

 

 

you will be able to notice that the logic is almost exactly the same in both LV and macro.

 

 

 

to experience the time difference,

replace the contents of the "setting" sheet of the macro workbook and the contents of the "master settings sheet.csv" with the contents of 

 

"settings for longer execution periods.csv"

 

 

 

in LV the time of execution is displayed by appropriate control in ms

in macro, the time is displayed via a msg box at the end of execution of the macro.

 

the intermediate times of executions have been obtained by appropriate contents of the settings sheets, (product of elements of 1st column = number of rows)

 

suggestions to improve style of coding in both platforms is very welcome.

Would love to understand the reason for the difference in execution time (frequent front panel updating is not the problem)

 

Thanks a lot.

Download All
0 Kudos
Message 5 of 13
(4,125 Views)

the replacement of setting sheet would set both programs for an output of 124416 rows...

0 Kudos
Message 6 of 13
(4,121 Views)

the replacement of setting sheet would set both programs for an output of 124416 rows...

0 Kudos
Message 7 of 13
(4,121 Views)

Is the post not clear…

I really want to solve the speed issue….

If any one is in the process of looking into this, please leave an update....

0 Kudos
Message 8 of 13
(4,082 Views)

Can't open your VI right now as I only have LV2011 available here with me…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(4,080 Views)

Sorry for the inconvenience

Please unzip and replace the vis

Have saved it for 11.0

 

 

0 Kudos
Message 10 of 13
(4,078 Views)