doubt with check boxes

3 次查看(过去 30 天)
DEEPTHI
DEEPTHI 2013-2-5
hi i am deepthi....i am doing project in relevence feedback for cbir....i implemented the project... code is
function displayResults(filename, header)
figure('Position',[50 50 1300 690], 'MenuBar', 'none', 'Name', header, 'Resize', 'off', 'NumberTitle', 'off');
% Open 'filename' file... for reading... fid = fopen(filename);
i = 1; % Subplot index on the figure...
while 1 imagename = fgetl(fid); if ~ischar(imagename), break, end % Meaning: End of File...
[x, map] = imread(imagename);
subplot(2,5,i);
subimage(x, map);
i = i + 1;
end
fclose(fid);
result is it will display 10 images.... i dono how to display 1 checkbox(named relevant) under each image...plz help me i dono about position of checkbox to be display...i have to get feedback from the user and at the bottom in the middle i want to display 1 button(feedback)...plz help me....

采纳的回答

ChristianW
ChristianW 2013-2-5
uicontrol('Style','checkbox')
%
doc uicontrol
  1 个评论
ChristianW
ChristianW 2013-2-5
编辑:ChristianW 2013-2-5
function checkbox_example()
close all; clc
M = zeros(5,2); % Matrix for checkbox values
for i = 1:10
subplot(2,5,i)
ax(i) = gca; %#ok<AGROW>
set(ax(i),'units','pixels')
pa = get(ax(i),'Position'); % Position of subplot axes
subimage(randi(3,6,4),jet(3));
set(ax(i),'XTickLabel',{},'YTickLabel',{},...
'XTick',[],'YTick',[],'TickLength',[0 0])
h(i) = uicontrol('Style','checkbox',...
'Position',[pa(1) pa(2)-5 pa(3) 20],...
'String',['Text' num2str(i)],...
'Callback', @box_value);
end
function box_value(hObj,event) %#ok<INUSD>
% Called when boxes are used
val = get(hObj,'Value');
M(h==hObj) = val;
disp(M')
end
end

请先登录,再进行评论。

更多回答(4 个)

DEEPTHI
DEEPTHI 2013-2-5
o/p screen is it displays the 10 images....i want to know how to display checkbox under each image ....

Image Analyst
Image Analyst 2013-2-5
Why not just use GUIDE to make a bunch of axes controls, each with a checkbox control underneath it?

DEEPTHI
DEEPTHI 2013-2-6
thanks christian...

DEEPTHI
DEEPTHI 2013-2-18
*function CheckBox_Callback(hObject,eventdata) if (get(hObject,'Value') == get(hObject,'Max')) % Checkbox is checked-take appropriate action
else % Checkbox is not checked-take appropriate action end end*
my output is it displays the top ten images and i have to select some of the images as relevent using the checkbox.if i check the image then the image name should be stored in some text file.i tried this function but i dono how to store the selected images(check) in to the text file plzzz provide me the code for this...
  1 个评论
ChristianW
ChristianW 2013-2-18
for j = 1:10, image_names{j} = sprintf('image %d',j); end %#ok<SAGROW>
selected = [3 7 1 10];
fid = fopen('relevant_images.txt', 'w');
fprintf(fid, '%s\n',image_names{selected});
fclose(fid);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by