Click here for some simple example code using the @water plugin.
From the Matlab help file, "help @water/WaterValvesSection"
% [x, y] = WaterValvesSection(obj, action, x, y) % % This plugin uses the water calibration table (constructed using % @WaterCalibrationTable) to automatically translate from a desired water % delivery amount into a time for which the water valve should be left % open. % % GUI DISPLAY: Puts up two numerical editable fields, Left microliters and % Right microliters, where the user can insert the desired dispense amount. % To the right of these will be two display fields showing the % corresponding times for which the valves should be left open. A title % will be above all these GUI fields. If the GUIs for the desired amounts % are edited by a user, (or changed by loading Solo settings), the dispense % times will be automatically recalculated. % % Note that @WaterCalibrationTable figures out dispense times for amounts % that are within 15% of the calibrated data points that it has; and that % calibrations have finite lifetimes. If asking for a value that is beyond % the known range of the calibration table, or the calibration table is out % of date, a warning window will go up, dispense times will acquire a red % background, and dispense times will go to a default value of 0.01 (i.e., % essentially nothing.) If your dispense times have a red background, that % means "recalibrate your table before using them" !! % % % PARAMETERS AND RETURNS: % ----------------------- % % obj Default object argument. % % action One of: % % 'init' x y % Initializes the plugin and sets up the GUI for it. Requires % two extra arguments, which will be the (x, y) coords, in % pixels, of the lower left hand corner of where this plugin's % GUI elements will start to be displayed in the current figure. % Returns [x, y], the position of the top left hand corner of % the plugin's GUI elements after they have been added to the % current figure. % Optional Params: % streak_gui  % If streak_gui is passed and set to 1 during init, then two % parameters are made visible that involve increasing rewards % for consecutive correct answers, ie. 'streaks': Streak_base % and Streak_max. See 'get_water_times' for further details. % e.g. [x,y]=WaterValvesSection(obj,'init',x,y,'streak_gui',1); % % 'set_water_amounts' l_uL r_uL % Requires two extra arguments; sets the GUI parameter for left % volume to the first of these, l_uL, and sets the GUI % parameter for right volume to the second, r_uL; then % recalculates the appropriate water dispense times. This action % is provided here to allow a command-line way of changing the % GUIs for left and right volume; the user can also change them % by hand, directly in the GUI. % % 'get_water_times' % Returns two values, LeftTime, and RightTime, which are the % water valve opening times that were calculated to correspond % to the GUI dispense amounts. % Optional Params: % streak_length % If streak_length is passed in: % WaterValvesSection(obj,'get_water_times',streak_length); % Then the returned Water time values are % water_time*Streak_base^min(streak_length,Streak_max); % % % 'calculate' % Force a recalculation of water dispanse times. This call % should normally never be needed by the user, since both % command line and GUI modes of changing desired dispense times % automaticaly force the recalculation. % % 'reinit' Delete all of this section's GUIs and data, and reinit, at the % same position on the same figure as the original section GUI % was placed. %