Re: if statement help
- From: "Adam Bright" <abc_services_2000@xxxxxxxxxxx>
- Date: Fri, 25 Apr 2008 23:31:01 +0000 (UTC)
Hi Walter,
is it possible you could help me further?
It appears that the script is working as there are no erros
showing but now,the matlab says its 'busy' and after 10 mins
is still not showing and graph display or error, this is the
code i used:
i=2; newpressure(1:length(pressure))=0;
while i <= length(pressure)
if ((newpressure(i) <
newpressure(i-1))&&((newpressure(i-1)-newpressure(i))>=150))
newpressure(i:i+5)=pressure(i);
end
i=1+5;
for j=i:length(pressure)
newpressure(j)=(pressure(j)-pressure(j-1))+newpressure(j-1);
end
i=1+1;
end
i've then continued with my script:
case1 = (newpressure < 673.2);
case2 = (newpressure < 995.7);
case3 = (newpressure >= 995.7 & newpressure < 1149.2);
case4 = (newpressure >= 1149.2);
volume = zeros(size(newpressure));
volume(case1) = 0;
volume(case2) = ((newpressure(case2)-442.95)*5.365);
volume(case3) = ((newpressure(case3)-749.29)*12.034);
volume(case4) = ((newpressure(case4)-934.08)*22.371);
roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson) wrote in
message <futmvj$ncp$1@xxxxxxxxxxxxxxxxxxxxxxx>...
In article <futm6u$6tc$1@xxxxxxxxxxxxxxxxxx>,shown here.
Adam Bright <abc_services_2000@xxxxxxxxxxx> wrote:
Hi, I've been trying to play around with it but I get the
following error:
??? Subscript indices must either be real positive integers
or logicals.
Error in ==> untitld at 3
if( ((A(i) < A(i-1))&&((A(i-1)-A(i))>=150)) )
A=[1500;1600;1793.00;1810.00;1827.00;1827.00;1845.00;1861.00;1876.00;1891.00;1686.00;1178.00;709.90;722.90;771.70;818.00;861.00;904.00;]
while(i < length(A)-5)
if( ((A(i) < A(i-1))&&((A(i-1)-A(i))>=150)) )
What is 'i' initialized to? There is no initialization
Could i be 0? Could i be 1? If i is 1 then A(i-1) would beA(0)
and 0 is not a real positive integerAnderson
--
"Okay, buzzwords only. Two syllables, tops." -- Laurie
.
- References:
- if statement help
- From: Adam Bright
- Re: if statement help
- From: Peter Boettcher
- Re: if statement help
- From: Adam Bright
- Re: if statement help
- From: Walter Roberson
- if statement help
- Prev by Date: graph of nodes connectivity in a matrix
- Next by Date: Re: graph of nodes connectivity in a matrix
- Previous by thread: Re: if statement help
- Next by thread: Matlab graphics and movies
- Index(es):
Relevant Pages
|
Loading