Gistlib Logo

gistlib

while loop check if its not y or n in matlab

main.m
userInput = '';
while ~(strcmpi(userInput, 'y') || strcmpi(userInput, 'n'))
    userInput = input('Enter y or n: ', 's');
end
disp('Valid input entered');
155 chars
6 lines

similar matlab code snippets

use while loop to validate user input. the input must be a 1x3 row vectow, if not, the code must notify and promt the user to re-enter the vector in matlab
using input form from user, use for and while loops for the number in matlab
while loop adjust uservalue while uservalue is less than 0 or greater than 80. if uservalue is greater than 80, then subtract 5 from uservalue. if uservalue is less than 0, then add 10 to uservalue in matlab
prompt the user 'please enter the fin dimensions [l,b, w] as a vector" and assign the user input to variables l, b, w, respectively in matlab
using input form from user, use for and while loops for the number and the shape provided by the user to make a triangle shape in matlab
import multiple .tiff images into a structure, with fields of filename and file size, and a user inputed pixel size field in matlab
create a while loop in matlab
create a while loop that will multiply all even numbers between 2 & 10 in matlab
import multiple .tiff images into a structure, from a user inputed directory in matlab
while loop in matlab

related categories

matlab
while-loop
user-input

gistlibby LogSnag