LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use array index??

Solved!
Go to solution

Please find attached snapshot

I am confused about working of index in array and i have highlighted the part which changes index

but i am confused how it changes index(because when index has 1 instead of 2,array shows 2 element while 3rd element gets 0 and similar case for index 0 where arrays show actual value for 1 element and other two elements get value of 0)

 

please note

array on left is control while that on right is indicator

0 Kudos
Message 1 of 10
(13,470 Views)

It sounds like you're using Array Subset instead of Index Array.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 10
(13,460 Views)

Index defines the index of the first element displayed in the array.

Every element before the first index displayed will be hidden. If the number of elements displayed is less than the number of elements remaining, the default value will be displayed (usually 0).

This is just a display no opearation  is done on the array when changing index ( unless you coded something but I can't say as you just posted a picture)

0 Kudos
Message 3 of 10
(13,455 Views)

Please check the attachments especially compare front_panel_1 and front panel_2

The latter shows two things(first index display and the other one is first element of elements display)  highlighted that are changed as compared to former

I am confused in effect of index display on elements display

 

I have also attached snap of block diagram for you

Download All
0 Kudos
Message 4 of 10
(13,421 Views)

Yes, so your array is [1, 0, 13, 4, 9] and you show them from offset 2, 1, and 0, what's the issue?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 10
(13,388 Views)

No my array had orginally [13,4,9] and when offset(index display) is showing '2',all of those three 3 elements 13,4and 9 are shown but when index display is changed to '1' ,all three elements are shifted right but last( right most) element'9' has no space to go and so 1st left most element becomes '0' while the two remaing elements 13 and 4 still shown as visible in attached photo

 

 

So issue is that how is index display working??

0 Kudos
Message 6 of 10
(13,381 Views)

If you have the control selected at 2 when you entered your numbers, you inserted them at index 2, 3 and 4. LV will fill the previous values with 0's since you cannot have empty elements at the start. Expand the control and indicator to show e.g. 7 numbers and set both indexes to 0 and it should become apparent.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 10
(13,376 Views)

what is the function of array index display??How it works??

 

when i change array index display from 0 to 2,all 3 elements of array become 0 starting from left as shown in 3 attached photos Q1,Q2 Q3

 

I have also attached snap of what ni website say about it and highlighted that also

 

Q1,Q2 and Q3 are not school questions they are my  queries just for self learnig

Download All
0 Kudos
Message 8 of 10
(13,352 Views)

@abtj1990 wrote:

when i change array index display from 0 to 2,all 3 elements of array become 0 starting from left as shown in 3 attached photos Q1,Q2 Q3


You mean starting from the right.  Also notice that the 0s are grayed out.  This is to indicate that there is no actual data in the array there.  It is just showing the default value.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(13,339 Views)
Solution
Accepted by topic author abtj1990

@abtj1990 wrote:

when i change array index display from 0 to 2,all 3 elements of array become 0 starting from left as shown in 3 attached photos Q1,Q2 Q3


Please notice, as your index increases, the shown numbers 'move left', as you're showing the data starting with the selected index. As mentioned above, 'outside' your array it fills with greyed out values to show it's an empty slot. How would you assume the indicator works, that it should change its size according to your array? That requires code and is not the default behaviour (also, it would be quite unfeasable with 100+ elements)

See picture; nulls are shown as greyed out 0's in LV, but it's also important information as the help states that should you try to read these values you'll get the default value (0).

index array.png

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 10 of 10
(13,280 Views)