LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
X.

Make the dimension size input of Initialize Array mandatory

Status: New

Nowhere in the Help for the Initialize Array function is it indicated that this is perfectly fine:

 

Screen Shot 2015-11-20 at 15.20.06.png

 

Unfortunately this situation could result from a Ctrl-B operation deleting a broken wire to the "dimension" input, and this could remain undetected for a while (and difficult to debug).

Since an empty array can be generated in other simpler way (for instance creating a constant), I am arguing that this "feature" of the function is more harmful than it is useful and should be replaced by a Mandatory Dimension Size input.

5 Comments
Manzolli
Active Participant

I can't see any specific use to leave the "dimension size" terminal unconnected. The only issue I can see is compatibility with code written in previous versions of LabVIEW. Since this idea is to make programming safer, Kudos!

André Manzolli

Mechanical Engineer
Certified LabVIEW Developer - CLD
LabVIEW Champion
Curitiba - PR - Brazil
X.
Trusted Enthusiast
Trusted Enthusiast

Well, it does allow you to create an empty array of a given type (which doesn't need to be a constant as in my example).

So it has its uses.

But I am starting to realize that a lot of the scripting and shortcut gizmos that have come up lately can end up with unintended consequences, some which might result in tough to debug problems.

 

Code written in past versions would simply get a zero connected to the dimension input when upconverted. I don't think that this is an issue at all.

AristosQueue (NI)
NI Employee (retired)

I agree with X.

Les__Bartel
Member

Make that input configurable. All functions that are already on the design are configured as "dimension size not required". When you place an initialize array function, the default is "dimension size required". Right click the vi to change this if you like.

X.
Trusted Enthusiast
Trusted Enthusiast

The other functions are different and intended to help with cleaning code. For instance, Delete From Array is happy without neither size or index connected:

 

Screen Shot 2015-11-24 at 13.53.12.png

 

But when you use this, you know that you are deleting the last element of the array. Pretty nifty. (Note that the default length is therefore 1 but when you go and create a constant from this terminal, you get a zero...). I am not sure it would be convenient for a developer to systematically select/unselect "mandatory" versus "recommended" for each occurrence of this function, depending on whether he/she fears a broken wire cleaned up by mistake.

 

Note that this mandatory nature exists for other functions such as Reshape Array.

 

I don't have a strong opinion on Array Subset (not requiring any input), although is it clear for everyone that this:

 

Screen Shot 2015-11-24 at 14.02.35.png or that Screen Shot 2015-11-24 at 14.04.17.pngreturns the whole array?

 

 

Is there a need for that function if it is not changing anything? I'd argue that the size input should be required here as well.

EDIT: actually, I take this back, as there is no "natural" value to insert for backward compatibility's sake. You would have to pull a "Array Dimension" function and connect it to the array and each of the dimension inputs. Not impossible to do, but maybe too much to be palatable for NI...