isequal function quary.. Need solution to compare two series.

1 visualización (últimos 30 días)
Nimisha
Nimisha el 25 de Feb. de 2016
Comentada: Nimisha el 26 de Feb. de 2016
result = 1 2 8 7 6 5 4 3 5 5 5 7;
if (isequal(128765435557,result));
a = 'ABC'
else
b = 'XYZ'
end
From one source i am getting some characters as mentioned in "result". All are separated by two spaces. And i want to compare it with pre defined series. But here i am getting error..
if (isequal(1 2 8 7 6 5 4 3 5 5 5 7,result));
|
Error: Unexpected MATLAB expression.
What will be the solution.?

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Feb. de 2016
if strcmp('1 2 8 7 6 5 4 3 5 5 5 7',result)
  3 comentarios
Andrei Bobrov
Andrei Bobrov el 26 de Feb. de 2016
result = '1 2 8 7 6 5 4 3 5 5 5 7';
if strcmp('1 2 8 7 6 5 4 3 5 5 5 7',result)
a = 'ABC';
else
b = 'XYZ';
end
Nimisha
Nimisha el 26 de Feb. de 2016
Thank You, This working for me..

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by