09-17-2019 02:51 AM
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
Solved! Go to Solution.
09-17-2019 02:56 AM
It sounds like you're using Array Subset instead of Index Array.
/Y
09-17-2019 03:02 AM
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)
09-17-2019 04:34 AM - edited 09-17-2019 04:50 AM
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
09-17-2019 05:53 AM - edited 09-17-2019 05:55 AM
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
09-17-2019 06:08 AM - edited 09-17-2019 06:11 AM
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??
09-17-2019 06:21 AM
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
09-17-2019 12:07 PM - edited 09-17-2019 12:09 PM
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
09-17-2019 12:15 PM
@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.
09-18-2019 03:32 AM
@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).
/Y