how to extract features stored in excel sheel for comparing data stored a variable.

I have stored some 12 image features into an excel sheet, I need to retrieve features row_by_row and compare these with the features stored in an variable.

Answers (1)

Have you tried using xlsread?

6 Comments

not getting how to use xlsread. I have written below code but its not woking...
filename = 'C:\Program Files\MATLAB\R2007b\work\colorfeatures.xlsx';
num_pages = length(filename);
for j = 1:num_pages
inputdata(1, :)=xlsread(filename,'sheet1',['A' num2str(j) ':' 'F' num2str(j)]);
if ((queryimagecolorMoments(1, :) == inputdata(1, :)) & (~(inputdata(1, :) == ' ')))
dir_out = imwrite('C:\Program Files\MATLAB\R2007b\work\input\*{j}.*');
end
num_pages = length(filename);
This gets the length of the string 'filename' and assigns it to 'num_pages'. I am assuming your intent was to assign 'num_pages' the number of feature you are trying to retrieve? Is MatLab giving you any error messages?
Actually its giving ans 58 for num_pages = length(filename).
So I wrote the line below:
if (queryimagecolorMoments(1, :) == inputdata(1, :))
dir_out = imwrite('C:\Program Files\MATLAB\R2007b\work\input\*{j}.*');
end
My intent is to compare the saved features (in Excel) with the currently computed values of query image. If the values match, the respective image should be saved in the output folder. For that I used imwrite in a for loop, but nothing is happening. It's printing values of queryimagecolorMoments =
97.5442 64.1190 90.8710 56.1908 50.7343 48.1986
like above and no image is saved in the output folder. (I am trying image retrieval... by giving an queryimage)
Plus you need to use any() or all() in your for loop if you're going to be comparing a vector of values.
I haven't tested it but the documentation seems to disagree. You can use matrices without any() or all().

Sign in to comment.

Asked:

hp
on 13 Jun 2017

Commented:

on 19 Jun 2017

Community Treasure Hunt

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

Start Hunting!