MATLAB Answers

0

Understanding the if command

Asked by Nikolaos Zafirakis on 14 Jul 2019
Latest activity Edited by KALYAN ACHARJYA on 14 Jul 2019
o = B(1:50,2);
a1 = diff(o);
[c1,d1] = find(a1>2^15);
[e1,f1] = find(a1<-2^15);
if c1 > 0;
o(c1+1:e1) = o(c1+1:e1)-2^16;
elseif c1 < 0;
o(c1+1:e1) = o(c1+1:e1)+2^16; % works good
else ; % Basically I need the command to say when e1 = isempty to use the statement below!
o(c(1)+1:end) = o(c(1)+1:end)-2^16;
end
plot(o)

  0 Comments

Sign in to comment.

1 Answer

Answer by KALYAN ACHARJYA on 14 Jul 2019
Edited by KALYAN ACHARJYA on 14 Jul 2019
 Accepted Answer

elseif isempty(c1)
o(c(1)+1:end)=o(c(1)+1:end)-2^16;
else
%do nothing
end

  0 Comments

Sign in to comment.