01-16-2012 04:00 AM
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
01-16-2012 04:55 AM
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?
03-06-2014 04:46 AM - edited 03-06-2014 04:48 AM
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....
03-06-2014 05:32 AM
03-06-2014 06:20 AM - edited 03-06-2014 06:21 AM
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.
03-06-2014 06:23 AM
the replacement of setting sheet would set both programs for an output of 124416 rows...
03-06-2014 06:24 AM
the replacement of setting sheet would set both programs for an output of 124416 rows...
03-11-2014 04:58 AM
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....
03-11-2014 05:03 AM
03-11-2014 05:08 AM - edited 03-11-2014 05:09 AM
Sorry for the inconvenience
Please unzip and replace the vis
Have saved it for 11.0