To get all the classes and functions from tops-dots added to your path, it is most convenient to have ToolboxToolbox installed and type, at startup:
tbUse('Lab_Matlab_Control')
Note: the above code should be run from the console directly as it currently doesn't work with Live Scripts.
List of linked items perhaps?
Almost all objects in tops-dots are classes. A class is a self-contained object which has two types of associated functionalities:
my_task = topsTreeNodeTaskSaccade;
To list the class' properties, simply look at the object: my_task
Classes are close relatives of structs. For instance, it is very easy to create a struct that will contain all the properties of a class:topsTreeNodeTaskSaccade with properties:
settings: [1x1 struct] timing: [1x1 struct] independentVariables: [1x1 struct] trialDataFields: {'RT' 'correct' 'fixationOn' 'fixationStart' 'targetOn' 'targetOff' 'fixationOff' 'choiceTime' 'feedbackOn'} drawable: [1x1 struct] readable: [1x1 struct] taskID: -1 taskTypeID: -1 trialData: [1x1 struct] trialCount: 0 trialIterations: 1 trialIterationMethod: 'random' randomizeWhenRepeating: 1 trialIndices: [] statusStrings: {} stateMachine: [] completedTrial: 0 iterations: Inf iterationCount: 0 iterationMethod: 'sequential' nodeData: [] helpers: [1x1 struct] inheritHelpers: 'all' helperTypes: {'drawable' 'playable' 'readable' 'writable' 'general'} children: {} startFevalable: {@run [1x1 topsCallList]} finishFevalable: {@run [1x1 topsCallList]} isRunning: 0 caller: [] startString: 'start' finishString: 'finish' name: 'topsTreeNodeTask' clockFunction: @mglGetSecs
struct(my_task)
Warning:
Calling STRUCT on an object prevents the object from hiding its implementation details and should thus be avoided. Use DISP or DISPLAY to see the visible public details of an object. See 'help struct' for more information.
To list the methods of a class instance, you have several options which are slightly different. The clearest one is to open the file where the class is defined:ans =
settings: [1x1 struct] timing: [1x1 struct] independentVariables: [1x1 struct] trialDataFields: {'RT' 'correct' 'fixationOn' 'fixationStart' 'targetOn' 'targetOff' 'fixationOff' 'choiceTime' 'feedbackOn'} drawable: [1x1 struct] readable: [1x1 struct] taskID: -1 taskTypeID: -1 trialData: [1x1 struct] trialCount: 0 trialIterations: 1 trialIterationMethod: 'random' randomizeWhenRepeating: 1 trialIndices: [] statusStrings: {} stateMachine: [] completedTrial: 0 iterations: Inf iterationCount: 0 iterationMethod: 'sequential' nodeData: [] helpers: [1x1 struct] inheritHelpers: 'all' helperTypes: {'drawable' 'playable' 'readable' 'writable' 'general'} children: {} startFevalable: {@run [1x1 topsCallList]} finishFevalable: {@run [1x1 topsCallList]} isRunning: 0 caller: [] startString: 'start' finishString: 'finish' name: 'topsTreeNodeTask' clockFunction: @mglGetSecs
edit topsTreeNodeTaskSaccade
The above command should open the MATLAB editor. From there, if you click on the "Go To" button in the menu, you will see a list of functions appear, each of these functions is a method!
Another way to get a glance at a task object is to call the help function on it:
help(my_task)
At the bottom of the console output that this command generates, a hyperlink "Reference page for topsTreeNodeTaskSaccade" appears. Clicking on it should make a help window for the object pop up. This help page will contain lists of all the properties and methods available for this object. However, these lists will also include properties and methods from parent classes. For more on this topic, see the next section.--- help for topsTreeNodeTaskSaccade --- @class topsTreeNodeTaskSaccade Visually and Memory guided saccade tasks
For standard configurations, call: topsTreeNodeTaskSaccade.getStandardConfigurationOtherwise:
- Create an instance directly: task = topsTreeNodeTaskSaccade();
- Set properties. These are required:
- task.drawables.screenEnsemble
- task.helpers.readers.theObject
- Others can use defaults
- Add this as a child to another topsTreeNode
The top line of the 'topsTreeNodeTaskSaccade.m' file that we opened earlier reads "classdef topsTreeNodeTaskSaccade < topsTreeNodeTask". Because of this, we say that the topsTreeNodeTaskSaccade class inherits from the topsTreeNodeTask class. This entails that all the properties and methods from topsTreeNodeTask (called the superclass) are also properties and methods of any topsTreeNodeTaskSaccade object, unless they are re-defined in the child class. Whenever a method from the superclass is re-defined in a class, we say that it is overloaded. An example of this can be seen with the finishTask() method. As an exercise, try to see the difference between the methods topsTreeNodeTask.finishTask() and topsTreeNodeTaskSaccade.finishTask().
TIn tops-dots, any experimental task should be defined as a class that inherits from 'topsTreeNodeTask'. We have already seen an instance of such task class earlier, this was our 'my_task' object.
Tower of Psych (tops) handles the 'TreeNode' structure on which any of our experimental tasks rely. On the other hand, Snow-Dots (dots) handles the interface to all the graphics, sound and input devices. Currently, whenever snow-dots functionalities are needed in a task (which fundamentally is a tops object), helpers are used.