Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: a simple control flow to find the index and replace
Date: Fri, 27 Feb 2009 07:41:03 +0000 (UTC)
Organization: CSU
Lines: 25
Message-ID: <go85ef$m38$1@fred.mathworks.com>
References: <go3lqs$md3$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 1235720463 22632 172.30.248.35 (27 Feb 2009 07:41:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 27 Feb 2009 07:41:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 951788
Xref: news.mathworks.com comp.soft-sys.matlab:521241


Thanks for your helps. I should make it more clearer and readable. 

Here is my two problems: 
(1) how to do some judgement based on a specific range of index? 
(2) how to approach my purpose by utilizing if ... end or while ... end? 

For example, I create a series of index<8760x1 double>, I like to sort out the index based on the conditions: (a) location from 1 to 1000, 8000 to the end and the rest; (b) the decimal value from 0 to 0.3, 0.7 to 1 and the rest. 

index = repmat((0:1/24:0.9584)',[365 1]);
value = rand(1,8760)';

if index(1:1000 & 8000:end)
index_tail=find(floor(index)<0.3 | floor(index)>0.7)
else
index_mid=find(floor(index)>=0.3 | floor(index)<=0.7)
if index(1001:7999)
index_tail=find(floor(index)<0.3 | floor(index)>0.7)
else
index_mid=find(floor(index)>=0.3 | floor(index)<=0.7)
end
index_final = find((index_tail) & value>0.8);

Please advice me how to correct my code. If I did not make my question clear or misunderstand the logics, please feel free to let me know. Thanks for your advices.

Michael