02-17-2024 06:56 AM
Hello, nice to meet you.
I have a few questions about LabView programs.
I'll attach my vi.
I receive random number data using a shift register. I want to place constraints here.
1. “datav1” and “data v2” arrays can store three pieces of data each. If 10 pieces of data (5 pieces each) are filled in each array, we cannot input them even if we press the start button.
2. We can fill “data v1” with 5 pieces of data and then fill “data v2” array with 5 pieces of data.
3. If the first data in the “data v1” array is 0.43, the next data cannot be entered into the shift register unless it is within 0.33 and 0.53 (+-0.1).
I want to add these conditions.
Who can help me?
Thank you,
Solved! Go to Solution.
02-17-2024 09:07 AM
if data_v1 and data_v2 can store three pieces of data, how can they have 5 pieces of data.
This looks like homework, can you post the original question?
02-17-2024 10:16 AM
Also:
02-17-2024 10:45 AM - edited 02-17-2024 11:31 AM
See if this can give you some ideas...
(Note that your teacher reads this forum too, so make sure you understand every single subtlety and put your own spin on it. It is a good learning experience to look at relatively clean and efficient code that avoids a lot of pointless duplications. For example why do you think you need two empty array constants to initialize the shift registers? One is enough!)
Note that the "clear" case can probably be inside the outer FALSE case for simplicity. Personally, I would probably use an event structure, but I don't know it it was already introduced in your course.
02-17-2024 11:01 PM - edited 02-17-2024 11:02 PM
thank you!
You told me perfectly what I wanted.
I learned a lot from you.
The reason I added “standard deviation and variance” is to filter the data. (I don't know what function to use, but I put it in for now.)
For example, if the first data of data v1 is 0.43, I would like to be able to receive the next random number only if it is a random number within 0.33 and 0.53 (+-0.1) (adjust the value with the control). (Even if you press the add button, it does not enter the array)
Of course, for data v2, I want to input the next data based on the first data, like the method above.
02-18-2024 09:49 AM
@hurang wrote:
For example, if the first data of data v1 is 0.43, I would like to be able to receive the next random number only if it is a random number within 0.33 and 0.53 (+-0.1) (adjust the value with the control). (Even if you press the add button, it does not enter the array)
Of course, for data v2, I want to input the next data based on the first data, like the method above.
Well, exactly defining the problem is 80% of the work. 😄
Should the very first point be the reference to decide if the new point is within range or should each new point be within range of the previous. For example if the first point is 0.43 and the second 0.50, what should be the allowed range be for the third (0.33-0.45 or 0.40-0.60), etc. In any case, all you need is keep the reference value in a scalar shift register and update as needed.
02-18-2024 10:34 AM
02-18-2024 07:41 PM
Thank you so much!
you are the best.
Could you please attach the vi?
I'd like to try it out.
02-18-2024 09:18 PM
Sorry, I am currently not near any computer. All the cases are the same as before and all additions are visible and easy to reproduce. Just a handful of simple primitives and a few wires. Try it.
02-19-2024 12:09 AM
Sorry, there was an error in delivering the message.
Data v2 is based on the 6th value.
In other words, if we receive a total of 10 pieces of data, data v1 is based on the first value, and data v2 is based on the 6th value.
Sorry for confusing you.