From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: if statement in if clause
Date: Sat, 09 Oct 2010 17:23:13 -0500
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <i8qq8f$nh7$>
References: <i8qpon$65s$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 9 Oct 2010 22:27:28 +0000 (UTC)
Injection-Info:; posting-host="wmrNV0dr30rreDWB/RUeVQ";
	logging-data="24103"; mail-complaints-to="";	posting-account="U2FsdGVkX19PNT2sLJ71jXwG1ZAsMbfG"
User-Agent: Thunderbird (Windows/20100228)
In-Reply-To: <HIDDEN>
Cancel-Lock: sha1:+0V5KiTWKBPf56Fu8G6gtnl6vks=
Xref: comp.soft-sys.matlab:677154

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 )
> else
> 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...