MATLAB Answers


How do you store outputs of functions activated using a user interface toolbar?

Asked by Margaret Redford on 2 Feb 2017
Latest activity Edited by Margaret Redford on 2 Feb 2017
The script I am currently working on is extremely layered, and was created before I began to work here. I am restructuring it and in doing so have found that the interface is generating the values I need, but is not storing them in the main script and I was wondering how to do this. The main measurement script (measurement.m) calls a function which opens a image figure & script (specialfigure.m). This in turn calls a function which adds a toolbar (newtools.m) with three uipushtool() buttons that use the handles of the respective 3 functions to call them. How can I store the output of these functions? I tried storing within the uipushtool() function but was unsuccessful in doing so. Current syntax is as follows:
toolb = uitoolbar(newfigure,'Tag','New Tools');
uipushtool(toolb,'TooltipString','Calibrate the Image','CData',iconimage,...
'ClickedCallback', @calibrationsystem,'Tag','Calibrate Tool','UserData','Both');
(Just to clarify, the last two arguments of uipushtool I believe reference whether the tool applies or not in a given scenario so that later it can be turned off or on). How do I collect the output of calibrationsystem() in a variable so that it can become an output of newtools.m and eventually be stored in a value in the overarching script? What is the easiest way to do this? I know that these values are being correctly calculated because I unsuppressed them in the function text and they print to the command window with no errors. Thanks!


Sign in to comment.

0 Answers