Handling to display figures on child axes in GUI
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Jan
2016년 5월 2일
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?
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!