필터 지우기
필터 지우기

Handling to display figures on child axes in GUI

조회 수: 1 (최근 30일)
Raady
Raady 2016년 5월 2일
댓글: Raady 2016년 5월 3일
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

답변 (1개)

Jan
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?
  댓글 수: 1
Raady
Raady 2016년 5월 3일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by