Handling to display figures on child axes in GUI
1 view (last 30 days)
Show older comments
Hi,
I am trying to display image in particular location of my gui.
I have a main GUI and I have axes1,axes2,axes3 to place 3 figures in it.when we use pushbutton1 it will ask to choose the file and it has to display that image on my gui in axes1.
It doesnt show error and output as well.
function main()
MW.f = figure('Name','Image Restr','Units','Pixels','Position', [680 500 1100 500]);
setappdata(0,'maingui',gcf);
MW.axes1 = axes('Parent',MW.f,'Position',[10 6 60 20]);
set(MW.pb1, 'Callback',{@push1,MW});
end
function []= push1(varargin)
MW = varargin{3};
[filename, pathname] = uigetfile('*.jpg', 'Image Files');
loadimg = fullfile(pathname,filename);
axes(MW.axes1);
imshow(loadimg);
end
0 Comments
Answers (1)
Jan
on 2 May 2016
What is "MW.pb1"? Are you sure that this callback function is entered at all? Set a breakpoint to check this.
Does the loaded image contain valid values? Control this by displaying it manually from the command window.
Can you see the axes obeject? What are the defaultAxesUnits? Perhaps they are "normalized" and creating the axes at "[10 6 60 20]" is far beyond the visible area of a figure?
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!