How apply more than one "if" to determine different changes in one "matrix"
Show older comments
Hi guys!
I want apply some conditions to determine my "data", starting from a "base" file. I tried this:
for i=1:length(base)
if isfinite(base(i))<=24.2;
data(i)=1.5393*base(i)-13.2;
if isfinite(base(i))>=24.8;
data(i,4)=1.3775*base(i)-9.93;
if isfinite(base(i))>24.2 & isfinite(base(i))<24.8;
data(i,4)=1.1147*homei(i,4)-3.184;
end
end
end
end
But only the first condition was resolved and i don't know what to do to resolve the others two.
Thank you already,
Gustavo
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 18 May 2014
Edited: Azzi Abdelmalek
on 18 May 2014
for i=1:length(base)
p=base(i)
q=isfinite(p)
if q<=24.2;
data(i)=1.5393*p-13.2;
elseif q>=24.8;
data(i,4)=1.3775*p-9.93;
elseif q>24.2 & q<24.8;
data(i,4)=1.1147*homei(i,4)-3.184;
end
end
Categories
Find more on Data Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!