フィルターのクリア

Loading a Histogram in a GUI with data from another Function

1 回表示 (過去 30 日間)
Luke Dineen-Woolnough
Luke Dineen-Woolnough 2016 年 3 月 3 日
回答済み: Image Analyst 2016 年 3 月 5 日
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.

回答 (2 件)

Geoff Hayes
Geoff Hayes 2016 年 3 月 5 日
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.)

Image Analyst
Image Analyst 2016 年 3 月 5 日
Try this:
function histObject = Hg(yourImage, handlesStructure);
subplot(1, 2, 2);
histObject = histogram(Im2);
% Switch current axes to axes2:
axes(handlesStructure.axes2);

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by