Using two axes in one GUI

1 view (last 30 days)
Christos Stefos
Christos Stefos on 2 Feb 2014
Edited: Christos Stefos on 4 Feb 2014
%I would like display the image (I) that the user selects in the axis with name axis1 and graph %the values of handle.perc_nu from different images in axis2 with hold on(while keeping previous %plots).A segment of my code follows. I am doing something wrong and it wont work!Can you please %help
function varargout = cell_confluency_calc(varargin)
varargout{1} = handles.output;
--- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
handles.output = hObject;
[fn, pn] = uigetfile('*.jpg','Please select your image file');
impath = strcat(pn,fn);
set(handles.edit1,'string',impath);
I = imread(impath);
imshow(I,[]);
pause(5)
handles.BI = I;%backup gia toggle buttpn
run('grayklim.m');
CI= I;
run('filterit.m');
run ('gemiseholes.m');
imshow(I,[]);
pause(5)
level= graythresh(I)- 0.22;
blackwhite= im2bw(I,level);
blackwhite= bwareaopen(blackwhite,100);
imshow(blackwhite,[] )
handles.bw= blackwhite;
mask =uint8 (blackwhite);
handles.blackcell= CI.*mask;
imshow (handles.blackcell, [] )
pause(5)
guidata(hObject, handles);
-- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
A = sum(sum(handles.bw));
cell_pixels = A;
all_pixels= numel(handles.bw);
handles.perc_nu=(cell_pixels/all_pixels*100)
handles.perc = [num2str(cell_pixels/all_pixels*100) '%'];
set(handles.edit2,'string',handles.perc )
hold
plot(axes2, handles.perc_nu)

Accepted Answer

Walter Roberson
Walter Roberson on 2 Feb 2014
  1 Comment
Christos Stefos
Christos Stefos on 4 Feb 2014
Edited: Christos Stefos on 4 Feb 2014
Oh ok now I get it. I corrected my code and it works fine..Thank very much..The corected version follows:
function pushbutton1_Callback(hObject, eventdata, handles)
handles.output = hObject;
[fn, pn] = uigetfile('*.jpg','Please select your image file');
impath = strcat(pn,fn);
set(handles.edit1,'string',impath);
I = imread(impath);
imshow(I,'Parent',handles.axes1);
pause(5)
handles.BI = I;%backup gia toggle buttpn
run('grayklim.m');
CI= I; %backup gia mask ths eikonas black and white parakatw
run('filterit.m');
run ('gemiseholes.m');
imshow(I,'Parent',handles.axes1);
pause(5)
level= graythresh(I)- 0.22;
blackwhite= im2bw(I,level);
blackwhite= bwareaopen(blackwhite,100);
imshow(blackwhite,'Parent',handles.axes1 )
handles.bw= blackwhite;
mask =uint8 (blackwhite);
handles.blackcell= CI.*mask;
imshow (handles.blackcell,'Parent',handles.axes1 )
pause(5)
guidata(hObject, handles);
function pushbutton2_Callback(hObject, eventdata, handles)
A = sum(sum(handles.bw));
cell_pixels = A;
all_pixels= numel(handles.bw);
handles.perc_nu=(cell_pixels/all_pixels*100)
handles.perc = [num2str(cell_pixels/all_pixels*100) '%'];
set(handles.edit2,'string',handles.perc )
hold on
plot(handles.axes2, handles.perc_nu,'Marker', 'o','markeredgecolor','k','markerfacecolor','r', 'MarkerSize',10 )
guidata(hObject, handles)

Sign in to comment.

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!