12-15-2025 01:39 AM
Im sorry but i cant follow you....
As i said i need to put in values in my array of stings at different places, for example index 2 and number 50.
I think i need a concrete example to understand.
12-15-2025 01:46 AM
I see now that i have to populate each index in numeric order to fill my array.
For example if i want to write 50 at index 2 i need first to write zero at index 0 and 1.
Is there a way to write 50 at index 2 without populate index 0 and 1 first?
12-15-2025 01:55 AM
Hi tokar,
@tokar wrote:
Is there a way to write 50 at index 2 without populate index 0 and 1 first?
No.
In LabVIEW you cannot have an array that only has an element at index 2, but not for index 0 & 1…
(In string arrays you can write empty strings at index 0 and 1 before appending "50" at index 2. Is this the only reason to hold numeric values in a string array?)
12-15-2025 02:00 AM
In LabVIEW you cannot have an array that only has an element at index 2, but not for index 0 & 1…
Answer: Ah ok
(In string arrays you can write empty strings at index 0 and 1 before appending "50" at index 2. Is this the only reason to hold numeric values in a string array?)
Answer: Perhaps it should be better to use an array of numeric values?
12-15-2025 02:10 AM - edited 12-15-2025 02:11 AM
Hi tokar,
@tokar wrote:
Perhaps it should be better to use an array of numeric values?
This depends on your requirements!
You didn't list all of them yet…
(Until now you just wrote about "how do I solve my problem?", but not about "what exactly is my problem?"…)
12-15-2025 03:04 AM - edited 12-15-2025 03:48 AM
@tokar wrote:
I see now that i have to populate each index in numeric order to fill my array.
For example if i want to write 50 at index 2 i need first to write zero at index 0 and 1.
Is there a way to write 50 at index 2 without populate index 0 and 1 first?
Kind of, reshape the array before. You will get default elements for new array elements. There is a node called reshape array that will grow or shrink an array.
place element at index while growing array if necessary
As Gerd said, arrays are always contiguous. There are no holes.
In other languages, you get a segmentation fault or a compiler error when writing to an array location that does not exist. (Or you modify the program in even more undesirable ways).
LabVIEW checks for out-of-bounds access and silently ignores the write. If you read from an out-of-bounds location, you get back the default value, which for numerics is zero, for strings an empty string.
12-15-2025 03:21 AM
People are helping you with your problem as requested, but in general you shouldn't use Front panel objects as data containers so the whole "reference front panel objects" is unnecessary/unwanted.
Indicators are just that, indicators. Keep the data in a cluster in a shift register.
12-15-2025 04:55 PM
12-16-2025 02:16 AM - edited 12-16-2025 02:59 AM
Hi tokar
First you need to initialise the array using any empty string and choose a size appropriate for the number of entries expected. Then you can use replace subset to change the contents of any index. all unchanged entries will be blank and not 0 (zero). If you want zeros initialise the array with a string entry "0".
I can't provide a snippet or image, no LabVIEW where I am.
12-16-2025 02:22 AM
Thank you all for all good information.
I solved my problem and got a better understanding of arrays now.
Cheers to all!