LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add elements into the 2D array

Hey all,
My name is Sarang Jaiswal. I have just started learning LabVIEW. I have a query , I want to enter elements into 2D Array. I want that user should enter the data in the numberic control and by pressing a button the value should be entered into the 2D Array.

I had already done this with 1D array and its working, but cant figure out how to do for 2D array...

I am attaching my 1D Array as attahment

Please help me out.

Thank You
--
Regards,
Sarang Dhananjay Jaiswal
Satyam Development Center, Banglore, INDIA
0 Kudos
Message 1 of 10
(6,838 Views)
There is no single solution, because in a 2D array there is more than one way to add an element. Do you want to fill it row by row or column by column? One of the dimensions must be fixed. Which one and what size? You would also need to pad with zeroes such that all rows are equal lenght.

The attached example shows one possible solution (LabVIEW 7.1).
Message 2 of 10
(6,823 Views)
Hey Christian Altenbach ,

Thank you very much. This is what i was looking for. Thanks once again.
--
Regards,
Sarang Dhananjay Jaiswal
Satyam Development Center, Banglore, INDIA
0 Kudos
Message 3 of 10
(6,809 Views)
hey all,
I am again stuck with the 1D Array. This time I am trying some other method for populating elements into an array. I am sending you all the .VI file

Please go through this . I think some synchronization problem is there. If I apply values manually to the "INSERT INTO ARRAY" then I am getting the solution but if I wire with the loop then if displaying all Zero's ...

Please tell me what is wrong with this VI ....

Thank You.
--
Regards,
Sarang Dhananjay Jaiswal
Satyam Development Center, Banglore, INDIA
0 Kudos
Message 4 of 10
(6,773 Views)
What exactly are you trying to accomplish with the vi? Are you trying to only enter values when "boolean" is true, or are you trying to only enter values on a click of the numeric?
0 Kudos
Message 5 of 10
(6,754 Views)
Your VI has the following problems:

At the first step, you are trying to insert at position 1 of a zero-sized array. This is outside and thus cannot be done. You can only insert at position zero in this case.

Possible solutions:
  • use built array (recommended).
  • leave the index of insert into array unwired and it will append at the end.
  • make the index shifter I32 (not U16!) and initialize the shift register with -1
  • do the "+1" after the insertion step.

    Secondary issues:
  • Use a small wait statement in the loop. Do you really want to run this loop millions of times/second consuming all CPU, doing nothing? With a wait, all othere computer services will be really thankful :).
  • A shift register for the array is much better than bunch of local variables.
  • There is no reason to use a sequence structure here. Think dataflow. The insert step cannot execute until it receives an input from the "+1". The order of things is fully determined by the wires. Sequence structures, especially stacked sequences hide code. Sequence locals often force backwards running wires. These problems make for code that is hard to read and maintain.

    Message Edited by altenbach on 06-28-2005 11:15 AM

  • 0 Kudos
    Message 6 of 10
    (6,751 Views)
    hi, Iam bharath..i want to create a a two d array of coordinates of points i click..pls suggest how to do?
    0 Kudos
    Message 7 of 10
    (6,387 Views)


    BHARATHINDIAN wrote:
    hi, Iam bharath..i want to create a a two d array of coordinates of points i click..pls suggest how to do?

    This is a duplicate post:
     
    0 Kudos
    Message 8 of 10
    (6,380 Views)
    can u pls help?

    0 Kudos
    Message 9 of 10
    (6,378 Views)
    0 Kudos
    Message 10 of 10
    (6,352 Views)