From: Muhammad Farooq on
I have a problem in executing the while as I have to conditions there. I am not a programmer and need your help. Do I need to post my m.file here or what should I do if anyone wants to help me.

Cheers
From: Steven Lord on

"Muhammad Farooq" <mfarooq52003(a)yahoo.com> wrote in message
news:hrp49p$66g$1(a)fred.mathworks.com...
>I have a problem in executing the while as I have to conditions there.

So you have a WHILE loop but you want to check two conditions? That's
simple enough -- connect the conditions with AND (& or &&) or OR (| or ||).

x = '';
prompt = sprintf(['Enter the string "continue" (without quotes) to
continue', ...
'\nor any other string to exit.']);
while isempty(x) || isequal(x, 'continue')
x = input(prompt, 's');
end

> I am not a programmer and need your help. Do I need to post my m.file here
> or what should I do if anyone wants to help me.

Well, it's kind of hard to help people if they don't show you what they need
help with, isn't it? Post a SMALL (try to get it down to no more than 20 or
so lines if possible) section of code that people can run to reproduce the
problem you're experiencing, and indicate specifically what the problem is.
As part of the process of simplifying the problem down to get the small
reproduction steps, you might even figure out the problem on your own
without posting.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: dpb on
Muhammad Farooq wrote:
> I have a problem in executing the while as I have to conditions there. I
> am not a programmer and need your help. Do I need to post my m.file here
> or what should I do if anyone wants to help me.

Well, it's hard to help w/o something to help about, yes...

Post the smallest example/subset of the code you can that demonstrates
where you have a problem and describe what you are doing, what you
expect as a result and what your specific (Matlab-related) problem is...

Meanwhile

doc while

and

"logical expressions" in the index may shed light on how to write conditions

--
 | 
Pages: 1
Prev: 3d plotting
Next: model to M-file