Handling to display figures on child axes in GUI

1 view (last 30 days)
Raady
Raady on 2 May 2016
Commented: Raady on 3 May 2016
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

Answers (1)

Jan
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?
  1 Comment
Raady
Raady on 3 May 2016
I initially started writing code with out using figure, currently I have sorted out my problem. Sorry not mentioning any comments about the code. MW.pb1 is pushbutton, and push1 is the call back function of pushbutton1. MW.f is the main figure, MW.axes1 is the place where i wanted to put my image for display on the gui. The default will be characters, so i have not mentioned units as pixels. The problem that I faced is " whether I am declaring the axes function correctly and in push button callback function whether I am calling(handling) the axes correctly.

Sign in to comment.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!