11-16-2012 11:46 AM - edited 11-16-2012 11:47 AM
Unfortunately i don't know how to use very well event structures.
I'll attach what i tried so far , it behaves strange
11-16-2012 12:00 PM - edited 11-16-2012 12:04 PM
Ok i'll specify more precisely although i don't know all the specific terms used in labview : I want to use the first 10 numbers given by the user control to build the 1D Array , the first element choosen must be the first element of the array and so one . And the array must deny access to numbers that ar already contained
The homework has some additional easier demands that depend on the issue that i presented.
I attached , what i tried so far
11-16-2012 03:32 PM - edited 11-16-2012 03:33 PM
Some hints:
See how far you get now. 😄
11-17-2012 08:25 AM
Thank you for the Hints
With one of them i disagree ( using a for loop instead of a while loop )
The reason that for loops shouldn't be used is : If we choose 10 iterations - the desired size of the array , it works perfect only if you don't introduce numbers that are already contained in the array , but if you do ,you will waste iterations and the final array will shrink in size.
Using you hints i managed to repair some big mistakes but i don't know how to store an array into a shift register.
In one of the VI's that i tried , i initialised the shift register with an array constant ( 10 zeros ) , and then i tried to replace the elements of this initial array with elements from the user input but i still don't know what i'm doing wrong.
I attached are my VI's
11-17-2012 01:02 PM
Laur wrote:With one of them i disagree ( using a for loop instead of a while loop )
Yes, in this case you would also need an event structure. Why spin the loop if nothing is added? 😄
11-17-2012 01:22 PM - edited 11-17-2012 01:23 PM
Here is a quick draft to get you started (LV 2012).
You need to add to the existing array from the shift register, not built a new array with every iteration. You are currently creating a new array with the last element as only element with every new iteration and place it in the shift register.
You also need to initialize the shift register, else it retains data between runs and would stop immediately on the second run.
This is all much easier than you currently think, you simply need to learn. 😄
(Since the array starts out empty, the current control value is immediately added when you run the program. Modify as needed if you don't want that. There are probably quite a few tweaks needed to make it into a nice, fully functional program. As I said, try an event structure. Currently, the sorting and min/max finding is done with every iteration of the loop. In principle, this only needs to be done whenever a new value is added.) 😄
11-19-2012 06:42 AM
Thank you very much for the draft , it works just fine
It helped me very much with my exercise