LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
David_L

"Change to array" / "Change to element" for controls, indicators, constants

Status: Completed

Available in LabVIEW 2015 and later

There should be an easy way to replace a control/indicator/constants of a certain type to an array of that same type, and vice-versa.

 

changetoarray.jpg

Message Edited by David_L on 12-04-2009 02:06 PM
14 Comments
Jarrod_S.
Active Participant
I've long wanted this functionality. Just as nice would be the opposite direction of changing an array into a scalar of the same type.
Jarrod S.
National Instruments
GregSands
Active Participant

Great idea!  But perhaps this is just a workaround rather than a solution.

 

What about removing the distinction between scalars and arrays (of any dimension) altogether?  I'm not talking about full-blown polymorphism (which allows run-time variation of types/representations), rather for an Array variable to have properties of Dimension and Size but still a constant representation.  Ideally these properties would be settable at run-time, and a Reshape method would enable the way the values were accessed to be changed.  Comments?

 

Darin.K
Trusted Enthusiast

I like this idea, if you want to try it out as a QD shortcut, I posted one here.

 

http://forums.ni.com/ni/board/message?board.id=170&thread.id=460930

 

tst
Knight of NI Knight of NI
Knight of NI
Greg, I have to admit I didn't understand how your suggestion would work and integrate into the LV strict typing scheme. I suggest you create a new idea with an illustration which would make it clearer.

___________________
Try to take over the world!
GregSands
Active Participant

My idea comes from the fact that I do a lot of work with both 2D and 3D arrays (for image processing).  I've got a fair number of routines that are essentially identical (say composed of a number of math/trig functions which themselves can adapt to the dimension) but I need at least 2 versions of the code, plus usually a polymorphic VI to handle them.  So I wondered whether it would be possible to have a more generic variable (perhaps an Array Class?) which represents all these essentially identical data structures as a single datatype.  I'm guessing that under the hood, arrays are handled as in C where a 3D index (i,j,k) is transformed into an address (k*nZ+j*nY+i) in a 1D array that actually holds the data.  So why not expose that to the user, without breaking the strict type checking - just relaxing it a little! 🙂

 

Perhaps this is the wrong thread to have suggested it, but it prompted the realisation that perhaps scalars are just 0D arrays anyway, and there shouldn't be any real difference between a scalar and 1D array (dimension 1) with a single value, and a 1x1 2D array, or a 1x1x1 3D array etc.  I'll have a think whether I can illustrate it and start a new thread.

silmaril
Member

I wouldn't call those items "Change to array" / "Change to element", but rather "Add Array Dimension" / "Remove Array Dimension" (which means you would have to invoke it twice to turn a 2D array into a scalar).

 

I agree that those items should be accessible for scalars, too, so we can easily turn a scalar into an 1D array an vice versa.

 

Also, it should be possible to do this with the block diagramm terminals of controls. Currently I can change the numeric representation of a numeric array control from the diagramm, but I cannot change it's dimensions without editing the front panel.

 

ST5
Member
Member

I also often needed this. I suggest to use the same option "add dimension/remove dimension" we already find on 2D, 3D,... arrays, also on 0D variables.

 

(don't know what I'm talking about? Create an  indicator array on the front panel, right click, see the list)

elset191
Active Participant
If altenbach's idea were implemented, I'd have very little use for this one.  But I still think it should be available.
--
Tim Elsey
Certified LabVIEW Architect
AndersBjörk
Member

I have already suggested this in

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Add-and-remove-dimensions-from-terminal-on-diagram-for...

 

To add or remove dimensions on controls and indicators from the diagram.

Message Edited by AndersBjörk on 01-31-2010 06:02 PM
ST5
Member
Member

Good Idea, but also me, I think it's better to make the aready existing "add dimension" and "remove dimension" for Arrays

possible for 0-dimension to 1-dimension and vice versa.