LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inserting single element into 2d array

Can I insert a single element into a 2D array in labview?
0 Kudos
Message 1 of 20
(14,885 Views)
Sure but instead of using "Insert Into Array", use "Replace Array Subset"


Message Edited by Day on 10-12-2006 02:59 PM

Message 2 of 20
(14,879 Views)
Depends what you mean by "insert".
  • You can replace an existing single array element with a different value using "replace array subset"
  • All colums and rows in a 2D array are of equal size, so truly inserting an element must alway be done by inserting an entire row or column. So only if the array is size Nx1 or 1xN it is possible to insert a single element. 😉

Makes sense?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 3 of 20
(14,874 Views)
 
0 Kudos
Message 4 of 20
(14,631 Views)
 
0 Kudos
Message 5 of 20
(14,629 Views)

I posted three times but there is no display of message I am trying the fourth time.

 

I tried inserting an element into a 2d array ata sepecified location but the resultant array doesnot seem to change.Why could it be?

 

regards

Sivanand

Message 6 of 20
(14,623 Views)

You cannot replace an element of an array if that element does not exist.

 

 For exemple trying to replace element on the 4th row and 1st column of a 3x3 array will result in the same array as output

 

 

     ====>>>>    
Message Edited by AntoineP on 10-09-2008 02:22 PM
Download All
0 Kudos
Message 7 of 20
(14,612 Views)

siva0182 wrote:

I tried inserting an element into a 2d array ata sepecified location but the resultant array doesnot seem to change.Why could it be?


We cannot debug an image, so please attach a real VI instead to make things easier for all of us. 🙂

 

There is no way to determine what's wrong with your VI, because we don't know the values of any of your controls. One possibility (as the above post suspects) hs that you are indexing outside the input array.

 

(On a side note, you typically would use "stop if true" for a loop condition. Also such a loop that just updates user input would need a small wait (e.g. 100ms) to make it play well with everything else running on your computer. You should also avoid overlapping wires. Right now it is impossible th tell what's connected to where :()


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 8 of 20
(14,578 Views)

Thanks for the suggestions and tips.After I intialized the array I was able to use the replace required elements in the array.

But after every time the array changed the next time we need to send/pass  the new array into replace array subset vi.

So I used a case structure to decide on if it is iteration 1 or higher iteration and if it is iteration no 1 I sent the newly intialized array and if it is higher iteration i sent thenew array (output of replace array subset) back to the array sunset thro the case structure.

 

Thanks for all people concerned.

 

regards

Sivanand Somasundaram 

0 Kudos
Message 9 of 20
(14,521 Views)

siva0182 wrote:

But after every time the array changed the next time we need to send/pass  the new array into replace array subset vi.

So I used a case structure to decide on if it is iteration 1 or higher iteration and if it is iteration no 1 I sent the newly intialized array and if it is higher iteration i sent thenew array (output of replace array subset) back to the array sunset thro the case structure.


Could you show us your actual code, because many of your terms are poorly defined (send/pass? Send back? sunset???).

I don't relly understand what you are doing.

 

(Typically you would use a shift register and either initialize it outside the loop or in a case wired to the "first run?" primitive.)

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 10 of 20
(14,484 Views)