Loading a Histogram in a GUI with data from another Function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I'm looking at using a push-button in a GUI to load up a histogram of an image that is already loaded into the GUI. I don't think I've got the handles quite right, can anyone suggest what im doing wrong?
Code below
Many Thanks
Luke
%%CallBack
set(h.buttonone, 'callback', {@addaxes1, h});
set(h.buttontwo, 'callback', {@applywindow, h});
set(h.buttonthree, 'callback', {@Hg, Im2, h});
then in seperate function (@Hg)
function Hg = Hg(hObject, eventdata, h);
subplot(1, 2, 2);
y = histogram(Im2), h.axes2;
I keep getting an error saying
"Error using Hg
Too many input arguments"
This error refers to the top line of function Hg.
0 comentarios
Respuestas (2)
Geoff Hayes
el 5 de Mzo. de 2016
Luke - I wonder if the problem is with the signature of your function
function Hg = Hg(hObject, eventdata, h);
You have named this function Hg but are also trying to return a parameter named Hg. What is the intent? How is this output variable used? Is it even necessary?
Also, please clarify when the above error occurs. (i.e. in response to what action by the user.)
0 comentarios
Image Analyst
el 5 de Mzo. de 2016
Try this:
function histObject = Hg(yourImage, handlesStructure);
subplot(1, 2, 2);
histObject = histogram(Im2);
% Switch current axes to axes2:
axes(handlesStructure.axes2);
0 comentarios
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!