View previous topic :: View next topic |
Author |
Message |
Ephemeral Advanced Member
Joined: 26 Jun 2025 Posts: 671 Location: UK
|
Posted: Wed Aug 20, 2025 12:20 pm Post subject: Constraining user inputs in matlab |
|
|
Anybody know how to constrain user inputs in matlab...
I have 4 probabilities A B C D
Id like the user to enter 3 values within the GUI (partially complete)
A B C
D is always set to <=1
------------------------------------------------
I have a loop like this that uses these values
if Probability <=A
do A stuff
if Probability <=B
do B stuff
if Probability <=C
do C stuff
if Probability <=1
do D stuff
-------------------------------------------------
Scenario 1
The user could enter for instance A as 0.6
This would leave 0.4 to be divided between B and C
Perhaps the user then enters 0.2 (but they cant enter more than 0.4 -- must be constrained)
Then maybe the user enters 0.1
This would mean
if Probability <=0.6
do A stuff
if Probability <=0.8
do B stuff
if Probability <=0.9
do C stuff
if Probability <=1
do D stuff
-------------------------------------------------
So basically within the GUI the user must not be allowed to run with an out of range value... in that case
A could not be more than 1
And having choosen to go with 0.6 as A the user then must define B as less or equal to 0.4
Maybe the only way is to send out an error message and ask the user to re-enter?
I cannot get the box to check the validity of the value itself?
|
|
Back to top |
|
Ephemeral Advanced Member
Joined: 26 Jun 2025 Posts: 671 Location: UK
|
|
Back to top |
|
|