```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: if statement in if clause
Date: Sat, 9 Oct 2010 23:34:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <i8qu5b\$940\$1@fred.mathworks.com>
References: <i8qpon\$65s\$1@fred.mathworks.com> <i8qq8f\$nh7\$1@news.eternal-september.org>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1286667243 9344 172.30.248.37 (9 Oct 2010 23:34:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 9 Oct 2010 23:34:03 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:677166

Can u clarify a little of what you mean? I am relatively a novice in MATLAB so don't really know how to manipulate state machines. Isn't there a simple syntactical solution that can make the code run?

dpb <none@non.net> wrote in message <i8qq8f\$nh7\$1@news.eternal-september.org>...
> Yayp Rafique wrote:
> ...
> > My very simple question is that how can I write an if statement in the
> > if-clause of a prior if statement. this isn't like the "easy" if
> > statement where I can write the nested if statement in then-clause or
> > the else-clause. i think its better if i explain through an example what
> > I would like:
> >
> > if(if(Z>0);A;else;B;end) > 0 && if(Z<0);C;else;D;end) > 0 )
>      F=5
> > else
>        G=3
> > end
> >
> > although this is not the correct syntax in MATLAB this is what I would
> > like.
>
> Matlab has no such syntax nor way I can think of to simulate it
>
> > The solution of "solving them the nested if statements before and
> > saving their results and then using these results" will not work because
> > I am writing a parser and I won't know the depth of nesting before hand.
> > I have to generate a MATLAB script as the output of my parser. I would
> > really appreciate feedback on how to do this.
>
> State machine comes to mind...
>
> --
```