Sometimes the "Make Current Values Default" causes a lot of unecessary data to be stored on the front panel. This shortcut makes it easier to empty arrays, saving lots of tedious clicking and context menu searching.
Alternatively, you can hold down shift, and all front panel arrays will be cleared. There is also the option to select array constants on the block diagram for clearing (but no clear all on the block diagram.... that's dangerous)
The shortuct is saved in LabVIEW 2011.
Great function, but it only works on 1D arrays. Is there going to be an update to handle multi-dimension arrays?
Ah, beat me to the punch. Fortunately you implemented the exact same way I was going to.
Fortunately you implemented the exact same way I was going to.
Yeah, I tried to come up with a more generic clever way to generate the arrays of empty (default) values, but ended up going with the simple brute force approach.
I didn't check it on the shortcut, but this code seems to return the default value for the data type and I would say you can't get much more generic:
Of course, you have to clear or ignore the error.
Actually, I should probably have checked it before posting. It looks like it just returns an empty variant. Here's something that does work:
I'm not 100% sure that dimensions of size 0 are the same as empty in this context, but I'm assuming it is. Maybe someone can check that.
Nice one, Yair. This is the approach I thought about taking, but then I was worried about using a non-default value from the original array. But then this morning (before I saw your post), I remembered that the VariantDataType VIs wipe out value information as they parse and set type info in the variant, so the approach would work after all.
Re: the Size value, I'm pretty sure that if the Type enum for a given Array Length is "Variable", then the Size value is ignored. The Size value only applies if you're setting an Array Length to be "Fixed" or "Bounded".
Now works by traversing the selected obect for all arrays, so you can select a cluster of arrays for instance, and it will clear all the arrays inside.