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

1 visualización (últimos 30 días)
Maxter Black
Maxter Black el 7 de Oct. de 2018
Editada: Matt J el 7 de Oct. de 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

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by