doubt with check boxes
조회 수: 1 (최근 30일)
이전 댓글 표시
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....
댓글 수: 0
채택된 답변
ChristianW
2013년 2월 5일
uicontrol('Style','checkbox')
%
doc uicontrol
댓글 수: 1
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개)
Image Analyst
2013년 2월 5일
Why not just use GUIDE to make a bunch of axes controls, each with a checkbox control underneath it?
댓글 수: 0
DEEPTHI
2013년 2월 18일
댓글 수: 1
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 Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!