LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Element insertion in Arrays

Solved!
Go to solution
Highlighted

I am new to LabVIEW, I go through certain LabVIEW online free tutorials and videos. I am trying to to do, in front panel user tell the dimensions of the array, then he inserts each element one by one and program should wait for user next value, to doing so I used two far loops to cater row and column and while loop to wait for user values.
Problem is it just get one value from me and then program stops and shows the array with only last index number new element. I hope I explained my problem well.
I am sorry, if I am in the wrong section.it's my first time to ask for help in the online community, looking for the best response. I have attached my LabVIEW file.

0 Kudos
Message 1 of 10
(694 Views)
Solution
Accepted by topic author Moonnight786
02-01-2018 07:42 AM

Hi Moonnight,

 

wh do you need all this stuff to fill a 2D array with user input?

Use autoindexing!

check.png

(You should rethink the inner while loop: it might be annoying not being able to input the same number for the next element…)

 

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 10
(688 Views)
Solution
Accepted by topic author Moonnight786
02-01-2018 07:42 AM

@Moonnight786 wrote:

I am sorry, if I am in the wrong section.it's my first time to ask for help in the online community, looking for the best response. I have attached my LabVIEW file.


This is exactly the right place, BTW.

 

The problem get's easier when you get to know (and properly use) the event structure.

 

To get to understand data flow, try the execution highlight. That will probably show you why the program stops and only returns one element.

0 Kudos
Message 3 of 10
(664 Views)

Thank you so much for the reply, I am a new user to LabVIEW, just messing with it to learn it. can you give me some basic tasks to do in LabVIEW, that would help me to establish my experience within LabVIEW environment? 

0 Kudos
Message 4 of 10
(642 Views)

Hi Moonnight,

 

something like this? Or the "Concepts" section in the LabVIEW help?

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 5 of 10
(633 Views)

Of course if you want to see the array as it is buidling up, its terminal needs to be inside the loop and updated with each iteration. That's also where a shift register comes in to hold the data across iterations.

 

Here is a very simple draft that shows you how to interactively fill an array inside a loop. Note that one FOR loop is sufficient, no need for Aztec pyramids of loops. Smiley Very Happy

 

FillArray.png

 

To adapt your code you would add your inner polling loop. Personally, I would probably use a dequeue in this loop and use a separate loop with an event structure to enqueue a new value (and spin that loop to add an element). Then you also need to decide how to proceed once the array is filled, etc. A good playing field to learn Smiley Very Happy

 

 


LabVIEW Champion Do more with less code and in less time
Message 6 of 10
(614 Views)

Hello GerdW,


Thank you for your time, something like this also means to me a lot, and I tried to find "concepts" section in LabVIEW help I could not find it. 

I am a 3rd year mechatronics engineering student, I read about LabVIEW unique features and NI hardware quite popular in the market, so I want to learn it and also I wish to do my final year project based on LabVIEW. so any help to improve my skill willbe highly appriciated. As a beginner felt it is quite complicated than other programming environments.
Regards 
Moonnight,

0 Kudos
Message 7 of 10
(594 Views)

hi,

0 Kudos
Message 8 of 10
(592 Views)

Hi Moonnight,

 

see this

 

As a beginner felt it is quite complicated than other programming environments.

The main and biggest difference is the DATAFLOW concept: you don't use "variables", you use wires!

(Well, if you would program for PLCs (graphically) or with Simulink then the difference is not as big.)

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 9 of 10
(579 Views)

wrote:

As a beginner felt it is quite complicated than other programming environments.


It's only difficult when you look for similarities to those other environments (NXG looks more like VS BTW). For most people, LabVIEW will be a lot easier to start with compared to e.g. C++. But for most C++ programmers, LabVIEW is difficult. Letting go all those rules (and learning others) is not easy.

 

You'll have to learn to relax and go with the wire flow...

Message 10 of 10
(569 Views)