필터 지우기
필터 지우기

when i push a button i want to load image on axes in GUI. so i tried this.

조회 수: 1 (최근 30일)
function pushbutton2_Callback(hObject, eventdata, handles)
k=zeros(100,99);
z=imshow(k);
imshow(z, 'Parent', handles.axes1);
*also tried this
function pushbutton2_Callback(hObject, eventdata, handles)
k=zeros(100,99);
imshow(k, 'Parent', handles.axes1);
but still nothing appears on axes1

채택된 답변

Image Analyst
Image Analyst 2016년 2월 21일
The problem is you were calling imshow to display the image, but then immediately after that you display only the handle ID, which is a single value. Don't do that.
Just do this:
imshow(k, 'Parent', handles.axes1);
Don't call imshow() twice.
  댓글 수: 2
Image Analyst
Image Analyst 2016년 2월 21일
Doing this
k=zeros(100,99);
imshow(k, 'Parent', handles.axes1);
will display a black rectangle. Is that what you were expecting?

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

추가 답변 (1개)

Stalin Samuel
Stalin Samuel 2016년 2월 20일
Refer the example file attached
  댓글 수: 4
misbah 0332
misbah 0332 2016년 2월 20일
i tried this but not working, can you please provide code that will written in call back of pushbutton, by pressing that button image display on axes
Walter Roberson
Walter Roberson 2016년 2월 20일
편집: Walter Roberson 2016년 2월 20일
The "function [] = callme(varargin)" is that code. However, it really should be passed S.ax so it can know where to display.
function [] = GUI()
SCR = get(0,'Screensize'); % Get screensize.
S.fh = figure();
S.ax = axes('units','pixels',...
'position',[50 100 300 230]);
S.tg(1) = uicontrol('style','toggle',...
'units','pixels',...
'position',[5 355 60 40],...
'string','click here',...
'val',1,'callback',{@callme, S.ax});
function [] = callme(src, event, ax)
k = rand(100,99);
imshow(k, 'Parent', ax);

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

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by