LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build sorted array, min/max

Hello everyone,

 

I have a task with Labview that I learn in university, but I am lost a bit.

I attached the final front panel.

Teacher helped with the following informations:

- adds a new value to a one-dimensional array if the new number is not already in the array

- when you press the stop button or access the 10 scanned items, enter the collected data

- use loop iterations and shift registers

- use build array to add new element

- use "array" functions palette

- use „Search 1D array” 

- use a logical OR connection to stop the cycle.

 

Could You help me?

Download All
0 Kudos
Message 1 of 7
(3,151 Views)

We can't help when you put a password on the VI to lock out the block diagram!

 

Which of those items have you accomplished and which are you stuck at?

 

PS:  "Informations" is not a word.  Information is the correct word whether singular one piece of information or plural, multiple pieces of information.

0 Kudos
Message 2 of 7
(3,125 Views)

Thank you for your reply.

This vi is the task, so the teacher put the password on the block diagram.

 

My task is to "figure out" the block diagram.

The first challenge to me: how can I add new elements to the array (shift registers, while/for loop, etc.)

 

I hope, I could define my problem. 🙂

0 Kudos
Message 3 of 7
(3,120 Views)

Yes.  You need a shift register so that it can hold the array data from one iteration of your loop to the next.

 

Look at the array palette for the functions on there.  In particular, 2 will be helpful for adding data to an array.  Build Array allows you to put an element at the beginning or end of any array.  Insert into Array is useful when you have to "Insert" the new element into the middle of an array.

 

You should also look at event structures.  When I run that password protected VI, I see that something happens only in the situation,someone  "changes the value" in that one particular control.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

Message 4 of 7
(3,116 Views)

@ChrisRapi wrote:

...while/for loop, etc.


Since you don't know the final number of iterations before the loop starts, you need a while loop, right?

 

(Note that one current flaw of the program is the fact that the sorted array indicator shows stale data when you run the VI a second time. That's not good. You set set the VI option..execution to "clear indicators when called" for better behavior. Another problem is the use of floating point numerics. In the most general case, equal comparisons of floating point numbers are dangerous and you also need to deal with e.g. users entering NaN, which potentially needs to be handled with extra code once you decide what to do with it)

Message 5 of 7
(3,101 Views)

Thank you for Your help! Finally, I finished this task with a "for loop" and a "case structure".

0 Kudos
Message 6 of 7
(3,064 Views)

Thank you for your help, shift register was a good idea 🙂

And the related videos were also helped me!

0 Kudos
Message 7 of 7
(3,063 Views)