05-27-2024 04:34 PM
Hello, I can successfully create an array with my step size and maximum value, but the big problem is i can see my minimum value. because is always starts from min+step size.
min = 0
max = 3
step size = 1
Now i am getting: 1,2,3
but i want 0,1,2,3
So my min value should be always there. How can i implement that?
Solved! Go to Solution.
05-27-2024 06:52 PM
I looked at you block diagram.
I didn't like looking at it because it's messy.
So I stopped looking at it.
05-28-2024 01:07 AM - edited 05-28-2024 01:10 AM
Hi medum,
@medum wrote:
So my min value should be always there. How can i implement that?
See this simplified suggestion:
Can you provide a more complicated example with expected output? (To verify my suggestion…)
Btw. LabVIEW already comes with a RAMP function…
05-28-2024 10:52 AM - edited 05-28-2024 11:26 AM
You can calculate the number of output elements from first principles before the loop sptarts, thus you should use a FOR loop.
We also have this function, of course.
( You also need to decide what to do if the range is not an integer multiple of the step size. (stop early, overshoot? coerce?)
For example what should happen for Min=2, Max=7, step=3? ([2, 5]?, [2,5,8]?, or [2,5,7]?, for example)? What should happen in Min>Max (ramp down? empty array?)? What should happen if min=max? What should happen if the step is negative?
Here is something to get you started but you need to expand to deal with unexpected inputs.:
In your earlier example, all inputs are integers. If this is always true, they should not be any orange anywhere!
05-29-2024 10:19 AM
Yes, I want with ur example that result is [2,5]. Because max = 8.
What can I do?
05-29-2024 12:36 PM
Hi medum,
@medum wrote:
I want with ur example that result is [2,5]. Because max = 8. What can I do?
You can implement to correct algorithm according to your requirements…
What have you tried so far and where are you stuck (now)?
05-29-2024 02:20 PM
@medum wrote:
Yes, I want with ur example that result is [2,5]. Because max = 8.
What can I do?
There are millions of way to do that, for example you could replace the division with quotient&remainder.
You still have not told us if the values are always integers or what the final purpose of all this is. (If fractional values are allowed, you might run into other issues due to limitations of DBL representation).
05-30-2024 03:38 AM
How is it look like?
05-30-2024 04:22 AM