LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labeled indicies : why not?

I was just thinking how convient it would be to have labeled indicies for arrays.

Has anyone else thought of this? 

In text based programming I always name my indicies in such as way that I know what's what.  I haven't found a way to do this with LV yet.


Just a thought
LV 8.6 on Windoze XP
0 Kudos
Message 1 of 14
(3,910 Views)

well you can easily do it:

1) use enums. they are labelled yet have a I32 value (note the coercion dot when using on numeric I32 indicator).

2) use rings. you can select any string and attach it to an index value.

i prefere the first option. yet, to use it as index labeller, i would be carefull.  if you want to lab your index, obviously you do not intend to use large arrays. Clusters are a much better way to handle predefined datasets.

in general, arrays are supposed to be identical datasets. i think it is best to keep treating them as so.

 

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 2 of 14
(3,904 Views)
I wouldn't propose that the labels for the indicies (dimension) are anything other  than annotational.  you know, like ilat, ilon, itheta, isample, iradar, ifreq, etc, etc, etc.  Just to make my databall and loops self-annotating.  Just right click on the index and select visible items> label.  Don't expose them if you don't want to.


Message Edited by Clueless1 on 12-11-2007 03:37 PM
LV 8.6 on Windoze XP
0 Kudos
Message 3 of 14
(3,900 Views)

i see.

in general your loops are generic. they do not know in advance which array they index. so no separated name to your array itself.
one workaround is to attach a separate contol to every array. this control would have the name you require, and you would loop it to loop your array. not elegant and i have trouble to see the purpose:again, LV is different than C# in that the arrays are automatically looped trough, so no need for an indexer.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 4 of 14
(3,893 Views)

i see.

in general your loops are generic. they do not know in advance which array they index. so no separated name to your array itself.
one workaround is to attach a separate contol to every array. this control would have the name you require, and you would loop it to loop your array. not elegant and i have trouble to see the purpose: again, LV is different than C# in that the arrays are automatically looped trough, so no need for an indexer.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 5 of 14
(3,892 Views)
All I'm asking for is a way to label the dimension so I know if my indexing tunnel is looping over latitude, longitude, or depth , or frequency, or whatever.  It's just something to help the programmer see what the program is doing.  Nothing would change about the way LV works.  Just add a little more meta-data to the array control/indicator/variable to label the dimension.
LV 8.6 on Windoze XP
0 Kudos
Message 6 of 14
(3,887 Views)

i am not sure what you need, but this might help:

you can always label a wire. either by just overwriting some documentation on the wire (i use white box without frame, >wire name>), or even better, by adding description to your wires (right click on the wire, description and tip). then, whenever your mouse tool is on wire, you will see the description of this wire as you entered!



Message Edited by Gabi1 on 12-11-2007 11:51 PM
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 7 of 14
(3,872 Views)
I've been thinking a bit more about indices. 

Why must all loop indicies be i.  If you could name the indicies, the index could then be a more usefull mnemonic.  With named dimensions, the index of indexed tunnels in loops could be named something other than i.  The index would be named according the named dimension over which the indexed tunnel is indexing.

You could also make the index name-able by right clicking the N in a for loop or something.  Or even just type in whatever you want in the index box.  The box would identify it as an index, but you'd know whether you're looping on lat, lon or altitude.
LV 8.6 on Windoze XP
0 Kudos
Message 8 of 14
(3,851 Views)
Clueless1,

There isn't any built-in functionality to do this, but one suggestion would be to manually keep track of your indices by adding documentation (double-click on the block diagram):


If you would like to see the functionality you described in future versions of LabVIEW, please feel free to submit a product suggestion.

Regards,



Message Edited by Devin_K on 12-12-2007 02:59 PM
0 Kudos
Message 9 of 14
(3,821 Views)
Instead of free labels, you can show the label of the loop structure and modify it. This keeps things organized and the text automatically maintains some physical connection to the object of interest.
 
Just a variation of Devin's idea. 🙂 
 


Message Edited by altenbach on 12-12-2007 01:31 PM
Message 10 of 14
(3,802 Views)