dimanche 1 avril 2018

How to define 3 conditions at the same time using while loop in Matlab

I want to my domain between 0 and 1 , I write while loop if x is not between 0 and 1, the codes continue until x value is between 0 and 1. It works! However, I add third condition, if input is empty , continue until , value is between 0 and 1.

    while 1

    if xw>1 || xw <0  || isempty(xw)
  prompt = {'order of the element:','the shape function number',...
'the x coordinate'};
title = 'Input';
dims = [1 35];

definput = {'','',''};
answer = inputdlg(prompt,title,dims,definput)
p=str2double(answer(1)) %convert string to double
n=str2double(answer(2)) %convert string to double
xw=str2double(answer(3)) %convert string to double
    else
        break
    end


end

Aucun commentaire:

Enregistrer un commentaire