10-16-2025 02:10 AM
I dont understand this error. I want to insert a string into a 2d string array at each row and column 0.
But it is showing these errors and I dont understand the errors. First of all, insert into array : more than one index input is wired. I want to insert at a certain row and column, so if i am not able to wire both, how will i do that. Secondly the broken wire is when I tried to connect a string variable into a new element/sub array option which means i should be able to insert an element. The error goes away when I put a build array to the string output. But I am not trying to insert an array. I am trying to insert a string variable. Both these errors doesnt make any sense. Can anyone kindly help me. Thank you.
10-16-2025 02:24 AM
Hi,
as an insert fuction changes the overall dimension of the 2D array, you cannot insert a single element, because it will cause undefined values, you always need to insert a whole row or column.
Editing a single element is only with the Replace subset function possible.
A possible solution for you would be to collect the data for a whole row / column and insert this. Take care that the dimension of the 1D array matches to the dimension of the 2D array where you want to insert it.
Another way would be to initialize an empty array with the final dimension and then use the replace subset function. I think this way would also be more memory efficient. Of course this requires to know the final dimension of the array.
10-16-2025 02:25 AM - edited 10-16-2025 02:32 AM
Hi govindsankar,
you're using LabVIEW for so long and still don't understand basics?
@govindsankar wrote:
I dont understand this error.
Error: you indexed the 2D array for exactly one element: you need to insert that single element - you cannot insert this way!
How should LabVIEW insert a single element into the 2D array? Should it insert row-wise or column-wise?
@govindsankar wrote:
I want to insert a string into a 2d string array at each row and column 0.
So you want to insert a new column: leave the row input unwired and only wire a "0" for the column input. Then you can insert the new column into the 2D array...
Why are there so many sequence structures? Still don't understand that "THINK DATAFLOW!" mantra?
Do you really think that creating two random numbers will need 1ms (or more)? The result of this time measurement will most often result in "0 ms"...
Btw. you should follow MECSOs advice on using an array of pre-defined size and use the ReplaceArrayElement function instead...
10-16-2025 09:29 AM
If 1 input is wired you can insert a column or row, and if 2 is wired you can input a separate element, you can't input a 2D array at a specific point.
The easiest solution if to loop through your replacement and replace them one by one.