LabVIEW Idea Exchange

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

Allow to name array indexes

Status: New

Hi,

 

As in the subject.

 

Now when you create an array the indexes of the array can be only labeled as the static comment field. There is not any build-in label/handler which could be used. Current situation looks like that:

 

qwerty.PNG

It would be better for readibility if developers could name the indexes and use it later on.

 

qwertyu.PNG

 

Picture represents the idea only, whole point is the description shoud be a build in handlers.

 

Now LV names first four indexes (when you hover over on it) as column, row, page, vol; later on are only dim 5, dim 6 and so on.

 

I believe if would increase readibility and save coding and debugging time.

 

18 Comments
altenbach
Knight of NI

It seems rare to have true 4D arrays, more typically you would have a 2D array where each column is a different parameter (time, temperature, frequency, power, humidity, etc.). What kind of measurement scenario would create a 4D array like you seem to have. Sorry, I don't quite get it.

 

(To name the elements of 1D arrays, I typcaily create an enum diagram constant that I wire to the index array. The item names are the names of the parameters.)

JÞB
Knight of NI

It seems rare to have true 4D arrays

I can think of where those labels might come in handy. Weather radar.  rho, theta, phi, Z (reflectivity), Vr(Radial velocity), Vrpp (Spectral width of radial velocity). are base dimentions.  many other products are derived from manipulations of that 6D raw data many of them need inputs from all six  (Wind shear, Hail and tornado detection/preditcion. Accumulation, cloud top, ..... )----  A guy can go just a bit crazy keeping them straight.

 

Still, those highD arrays are not common and often can be resturctured.


"Should be" isn't "Is" -Jay
MimiKLM
Active Participant

Yes, I agree it is rare.

 

4D matrix I've used, I used only for example; but it could be something as simple as 2D array. Even in this 2D example the idea I've proposed could significantly improve readability.

 

If someone has to use 3D or even more dimensions - yes, agree, it's rare - the benefit comes from improved readability will be even higher.

 

I can risk the opinion that with my feature proposed multidimensional array won't be so 'scary', and used more often. I think, that sometimes users avoid usage 3D and moreD array because they want avoid mess with accessing/indexing them.

 

Nevertheless, 1D or moreD - my idea improve readability and programing.

AristosQueue (NI)
NI Employee (retired)

I took some time over the last couple days to contemplate this and I've decided I REALLY like it, and not just for 4D arrays. I'm wanting it for 2D arrays. "Row" and "Column" are nice and all, but indexing over "person" and "exam" to find the grade for each would be nicer. In text code, sometimes I iterate with "i" and "j", but just as often, I name my iterator variables something more relevant to the matrix of data. This is analogous.

 

It's a small little feature, but since I'm forever reversing array dimensions, I think this could be a real help. It gets my kudos.

MimiKLM
Active Participant

Yes,

 

That's AristosQueue, that's I'm coming from.

 

The best solution would be full binding (naming not only the dimensions but particular elements) but we can start with this.

AristosQueue (NI)
NI Employee (retired)

Binding particular elements would be a job for clusters. I wouldn't back that as "particular elements" come and go in any given array. Dimensions always exist, even when length is zero. Also, if you want to index as a paritcular name, use an enum to name indicies.

MimiKLM
Active Participant

I just mention the bindings, but I describe it as a separate idea later on.

 

Dimensions, in my opinion, should be named any way.

Intaris
Proven Zealot

What would be cool for a named multidimension array is if when autoindexing into a for loop the context help for the wire tells you which dimension it is.

 

Come to think of it, that would already be cool without names.....

AristosQueue (NI)
NI Employee (retired)

Intaris: It's always the first dimension, no matter what size the array is. What would you want in the CH exactly to reflect that? Are you talking about when you hover over the tunnel? Or something else?

JÞB
Knight of NI

 Intaris: It's always the first dimension, no matter what size the array is What would you want in the CH exactly to reflect that? Are you talking about when you hover over the tunnel? Or something else?


But does it have to be?  Now That's an idea  Allow Dimension Selection on Auto-Indexing Tunnels for nD Arrays.

 


"Should be" isn't "Is" -Jay