Preventing text input for a variable
7 ビュー (過去 30 日間)
I am working on a function where a user with no prior coding experience should be able to input a series of numbers to define my variables. The variables must be between 1 and 30 and must be an integer.
I currently have preventions to stop numbers outside of 1 and 30 (using logic) and another to stop decimals (using round(Var)).
The last prevention I am looking for is stopping the user from inputing words or letters. Ex: Var=q
I appreciate any help.
Fxn(20) %Input must be between 1 and 30; cannot be a word or letter
if x<1 | x>30
disp("Variable must be between 1 and 30")