Loading a Histogram in a GUI with data from another Function
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
Geoff Hayes
on 5 Mar 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 Comments
Image Analyst
on 5 Mar 2016
Try this:
function histObject = Hg(yourImage, handlesStructure);
subplot(1, 2, 2);
histObject = histogram(Im2);
% Switch current axes to axes2:
axes(handlesStructure.axes2);
0 Comments
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!