MATLAB: I need a code to select an image manually from stored database so the image recognition will give more interactive user environment

manually image choosen

I am using AT&T database in my system and i have successfully inserted my image in the database and also database in loaded without an error… i have currently using the code-
%%Initializations
% We randomly pick an image from our database and use the rest of the
% images for training. Training is done on 399 pictues. We later
% use the randomly selectted picture to test the algorithm.
ri=round(400*rand(1,1)); % Randomly pick an index.
r=w(:,ri); % r contains the image we later on will use to test the algorithm
v=w(:,[1:ri-1 ri+1:end]); % v contains the rest of the 399 images.
please help me out to choose an image manually.

Best Answer

num_image = size(w,2);
prompt = sprintf('Choose an image number, 1 to %d', num_image);
ri = str2double(inputdlg(prompt));
if isnan(ri) | ri < 1 | ri > num_image | ri ~= fix(ri)
error('Not a valid image number');
end