필터 지우기
필터 지우기

doubt with check boxes

조회 수: 1 (최근 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에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by