USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

Constraining user inputs in matlab

 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Shell Scripting and Programming
View previous topic :: View next topic  
Author Message
Ephemeral
Advanced Member


Joined: 26 Jun 2024
Posts: 671
Location: UK

PostPosted: Wed Aug 20, 2024 12:20 pm    Post subject: Constraining user inputs in matlab Reply with quote

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
View user's profile Send private message
Ephemeral
Advanced Member


Joined: 26 Jun 2024
Posts: 671
Location: UK

PostPosted: Sat Aug 23, 2024 2:23 pm    Post subject: Reply with quote

Ok ive sorted this now Cool

All within one menu loop without updating the global variables


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Shell Scripting and Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse