How to compare two elements in an array with not equal operator(~=)?

1 vue (au cours des 30 derniers jours)
Maxter Black
Maxter Black le 7 Oct 2018
Modifié(e) : Matt J le 7 Oct 2018
for i=2:1:length(R)
if(R(i)==R(i-1))
else
dif=[dif,R(i)];
end
end
dif=[R(1)];
For example if my input is: [ 3 3 3] dif =dif =
3.0000 3.0000
  2 commentaires
madhan ravi
madhan ravi le 7 Oct 2018
What’s R ?
Image Analyst
Image Analyst le 7 Oct 2018
Do you mean like
if R(i) ~= R(i-1)

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by