switch case in MATLAB

Status
Not open for further replies.

royvincent

Member level 2
Joined
Jan 28, 2010
Messages
52
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
India
Activity points
1,610
Hai

Every time I get an image, I need to compare it with a lot of existing images and take an appropriate decision. But, the 'elseif' statement makes it very slow. But I cant use switch case because the switch expression needs to be a scalar or string. How can I do my comparison in a faster way?

Please help. :-(

Thanks
 

I am just using the following commands:

eg;

a=imread('abc.jpg');
b=imread('xyz.jpg');
.
.
.
.

new=imread('New_Image.jpg');

%the following code is for comparison (which I like to do with switch case)

if(new==a)
.......
elseif(new==b)
.......
.
.
.
.
end;

can I do this with switch statement?

Thanks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…