how to match the first letter of the title of an image with the input query?

1 次查看(过去 30 天)
I need to match a letter with the first letter of the name of the image from the database and display the image.
I have done the following code
load 'mydatabase.mat'
Symbol = input('Enter the symbol you want to test for (A,B,C,Five,Point,V)-','s');
for (i=1:length(files))
if(strcmpi(files(i).name(first),'Symbol')==1)
imshow(file);
disp('letter retrieved');
else
disp('Incorrect input');
end
end
The code is giving error on the fourth line since 'first' is not a correct keyword. Please enlighten me Thank you

采纳的回答

Image Analyst
Image Analyst 2014-3-16
Use 1 instead of first because indexes have to be numbers, or a variable that has a number in it. You never defined first at all so it doesn't know what it is.
  4 个评论
Image Analyst
Image Analyst 2014-3-16
I can't run your code. You did not attach the mat file and did not show how you generated the "files" variable.
Zahra
Zahra 2014-3-19
This is the code used to create the mat file. And i have the corresponding mat file attached as well. I now want to retrieve the image based on the title of the image. Cant figure out where the issue is!

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by