03-31-2019 09:20 AM
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?
03-31-2019 12:29 PM
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.
03-31-2019 12:51 PM
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. 🙂
03-31-2019 12:58 PM - edited 03-31-2019 01:06 PM
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
03-31-2019 02:17 PM - edited 03-31-2019 02:42 PM
@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)
04-01-2019 12:42 PM
Thank you for Your help! Finally, I finished this task with a "for loop" and a "case structure".
04-01-2019 12:43 PM
Thank you for your help, shift register was a good idea 🙂
And the related videos were also helped me!