Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How can I make these lines shorter?
Date: Mon, 9 Mar 2009 05:30:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <gp29gs$6qh$1@fred.mathworks.com>
References: <gp295g$dn1$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1236576604 6993 172.30.248.35 (9 Mar 2009 05:30:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Mar 2009 05:30:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1477385
Xref: news.mathworks.com comp.soft-sys.matlab:523405


"Husam Aldahiyat" <numandina@gmail.com> wrote in message <gp295g$dn1$1@fred.mathworks.com>...
> Hello,
> I created an algorithm and everything works fine, but there are line that I think can be made shorter using a command or technique I don't know about. Here are the lines:
> 
> sign2=round(((~abs(sign(round(diff([con(1),con(3)])))))*(-2*((~(~(con(3)-con(2)+1)))*...
> (~(~(con(3)-con(2)-2))))+1))+~(~abs(sign(round(diff([con(1),con(3)]))))));
> 
> 
> sign1=round(~(~abs(sign(round(diff([con(1),con(3)])))))*...
> 	-2*(~(~(sum(ismember(diff(con),1)))))+1);

con is a three element vector with each element having a value of 1, 2 or 3.