Borrar filtros
Borrar filtros

Handling to display figures on child axes in GUI

1 visualización (últimos 30 días)
Raady
Raady el 2 de Mayo de 2016
Comentada: Raady el 3 de Mayo de 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

Respuestas (1)

Jan
Jan el 2 de Mayo de 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 comentario
Raady
Raady el 3 de Mayo de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by