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

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.?

 Accepted Answer

if strcmp('1 2 8 7 6 5 4 3 5 5 5 7',result)

3 Comments

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
I write above script, But still gives error..
result = 1 2 8 7 6 5 4 3 5 5 5 7
|
Error: Unexpected MATLAB expression.
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
Thank You, This working for me..

Sign in to comment.

More Answers (0)

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Asked:

on 25 Feb 2016

Commented:

on 26 Feb 2016

Community Treasure Hunt

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

Start Hunting!