I would like to return a value from a function, based on the type of click that was used.
I have the following codes:
figurei = 0;plot(rand(5))val = set(gca,'buttondownfcn',@mybttnfcn)
and
function value = mybttnfcn(h,~) hf = get(h,'parent'); b = get(hf,'selectiontype'); if strcmpi(b,'normal') value = 1; disp(value) elseif strcmpi(b,'alt') value = -1; disp(value) else value = 0; disp(value) end
I would want to capture the 'value' from the function, into a variable where the call happens. Thanks!
Best Answer