Filter löschen
Filter löschen

doubt with check boxes

1 Ansicht (letzte 30 Tage)
DEEPTHI
DEEPTHI am 5 Feb. 2013
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....

Akzeptierte Antwort

ChristianW
ChristianW am 5 Feb. 2013
uicontrol('Style','checkbox')
%
doc uicontrol
  1 Kommentar
ChristianW
ChristianW am 5 Feb. 2013
Bearbeitet: ChristianW am 5 Feb. 2013
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (4)

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

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

DEEPTHI
DEEPTHI am 6 Feb. 2013
thanks christian...

DEEPTHI
DEEPTHI am 18 Feb. 2013
*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 Kommentar
ChristianW
ChristianW am 18 Feb. 2013
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);

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by