datastructs = endSession(datastructs [,'tokens'] [,'params'] [,'message'] [,'feedback'] [,'information']) [] = optional parameters '' = parameter-value pairs


ENDSESSION is for use at the end of any experiment: it restores user input, lets the recoveryManager know that the opened datastructs have been closed, runs any end-of-task scripts you may have specified, and places a timestamp on the end of the study. Call this function once you are done with all of your easyFunction calls, and supply the finished datastructs to this function. Note that you must supply all the datastructs that you used in startSession (see "help startSession" and "help recoveryManager" for more details).


endSession(datastruct1,datastruct2, ...) ends the experimental session by updating the recoveryManger, writes experiment endtimes to disk for all datastructs. Note that ALL datastructs supplied to startSession must be provided here, or an error will be thrown. [datastruct1, datastruct2, ...] = endSession(datastruct1,datastruct2(...) acts as above, but returns the updated datastructs. Note that the datastructs are now "sealed" and can no longer be written to. [datastruct1, datastruct2, ...] = endSession(datastruct1,datastruct2, ..., PARAM1,VAL1,PARAM2,VAL2...) acts as above, and also sets various optional parameters. Parameters are case-insensitive, and each string parameter must be followed by a value as indicated: 'tokens' Struct. A structure containing temporary pointers (e.g., to the main window, and to the user's input device, such as a keyboard) that are used during the experiment but are not meaningful after that. Default: [] 'params' Struct. A structure generated by easyLaunch that contains information about the environment the experiment is being run in. That includes things like the nature of the computer hardware, display size, and the paths to where things like the participant data files are stored, and where the executed function is found. Default: see code for various defaults 'message' String. A message to be displayed to the participant before the screen is removed. The message will be shown for 5 seconds, or the time supplied in the time.end_session_msg field of the params object, if one was supplied. Default: '' 'information' Any variable. Similar to startSession, any parameter you supply here will be attached to all of your datastructs in an "exp_end_info" field. This could be useful for storing a struct containing details about your experiment (e.g., output from a staircasing algorithm). Default: [] 'end_func' String or function handle. Run a custom function (prior to feedback) that is specified as as string or function handle. The function will have access to all of the included datastructs. This could be useful for, e.g., providing feedback to the user about their performance. Any provided script must accept arguments in the form myfunc(params, tokens, datastructs, end_func_args). Default: [] 'end_func_args' Cell array. A cell array of arguments to be passed to the custom function. Default: {} 'feedback' Boolean. If true, feedback will be gathered from the user about the session they just completed. Feedback text will be displayed and a textbox will be provided until they indicate they are ready to continue by pressing a key. Default: false