This page describes all of the function in the CogToolbox. For installation instructions and more, please see the main CogToolbox page.
Functions in the CogToolbox were written by Scott Fraundorf, Michael Diaz, Jason Finley, Molly Lewis, Kristen Tooley, Angie Isaacs, Sarah Brown-Schmidt, Tuan Lam, and Laurel Brehm.
AdditionDistractorTask | Presents 2-digit addition problems for a specified duration. |
DivisionDistractorTask | Presents 2-digit division problems for a specified duration. |
MathDistractorTask | Presents 2-digit addition and subtraction problems (mixed) for a specified duration. |
MultiplicationDistractorTask | Presents 2-digit multiplication problems for a specified duration. |
SubtractionDistractorTask | Presents 2-digit subtraction problems for a specified duration. |
BWtoRGB | Converts a black-and-white or grayscale image to RGB format. (This doesn't colorize the image; it just changes the format so you can do color-related operations on it.) | |
changeFolder | Updates MATLAB's active directory to the directory where the current script is. | |
csvToStruct | Opens a comma-separated spreadsheet with a set of named columns and converts it to a struct ... slowly | |
dualfprintf | Prints using fprintf both to the MATLAB Command Window and to a file | |
getSubjectNumber | Gets a valid subject number from the experimenter and verifies it hasn't already been used. Optionally, can also rotate subjects through a set of lists. | |
imageToTexture | Loads an image from a file and puts it in a new texture. | |
loadimage | Loads an image from a file and puts it in a new offscreen window. This window can then be quickly copied to another using PTB's Screen("CopyWindow") function | |
makeValidPath | Ensures that a path is a properly formatted folder name, and creates that folder if needed. | |
openValidFile | Repeatedly prompts the user for a filename until a valid file is opened | |
picturetester | Displays a folder of pictures one at a time to make sure they look good in your experiment. | |
save_triang | Saves the upper- or lower-triangular part of a matrix | |
Screenshot | Takes a screenshot of the current experiment display and save it in a file that you can use to demonstrate your experiment. | |
textFileToCellArray | Reads a text file into a cell array, with each line as one entry in the cell array. Optionally, can read just a limited # of lines. |
allKbNames | Display the numerical code corresponding to each keyboard key. For use in programming only. |
getKeys | Waits for the user to press a key and determines what key was pressed. Unlike PTB functions, this ignores keys already been held down. Optionally, can end after a maximum time has elapsed with no keypress. |
Wait4Key | Waits for the user to press one of a particular set of a keys and returns the RT and key pressed. |
Wait4KeyTimed | Same as Wait4Key, but can force the user to respond with a particular time limit. |
Wait4Mouse | Waits for the user to click one of a particular set of regions on the screen. Returns RT and area clicked. |
Wait4MouseTimed | Same as Wait4Mouse, but with a time limit. |
listmaker | Creates sets of experimental lists using Latin Square designs. Can include multiple factors and filler trials. |
makeLagList | Creates a presentation list for an experiment in which the stimuli vary in lag between 1st and 2nd presentation. Can also include non-repeated stimuli. |
containsDuplicates | Tests if any value is repeated more than one in a matrix. |
countValue | Counts how many times a specified value appears in a matrix. |
fitROC | Fits an ROC curve to some data. |
horizshift | Shifts elements horizontally within each row of a matrix. |
hourmin | Returns a nicely formatted version of the current time (optionally, with seconds) |
InscribeCircle | Finds the x, y coordinates for a point inscribed in a given circle. |
iseven | Determines whether a given number is an even integer |
IsInBounds | Determines whether a particular point would be within the bounds of a N-dimensional matrix. |
isodd | Determines whether a given number is an odd integer. |
modrz | Performs modular division (remainder of X divided by Y), but replaces outputsof 0 with Y. |
nth | Performs a given function, and returns the Nth element of the result of that function |
RaggedCellArrayToMatrix | Converts a cell array of vectors, which may be of uneven length, into a matrix. |
randorder | Puts the elements of a vector in random order. |
repelem | Creates a vector with each element repeated a certain number of times. |
reversescore | Reverse score a Likert scale response. |
reversevector | Puts the elements of a vector in reverse order |
CenterOnScreen | Demo of how to make your own functions in Matlab. |
graphicsdemo | Demo of how to do graphics in Psychophysics Toolbox. |
InstructionsScreenDemo | Demo of how to use the InstructionsScreen function. |
matlabbasics | Demo of how to do basic operations and run an experiment in Matlab. |
RSVP | Demo of stimulus display, in the context of a simple rapid serial visual presentation task. |
selfpaced | Demo of stimulus display and user response, in the context of a simple self-paced reading task. |
sounddemo | Demo of how to play & record sound in Psychophysics Toolbox. |
visualworld | Skeleton of a visual world eye-tracking experiment that provides accurate timing measurements and flicker-free picture display and movement. It has to be filled in with the details of your experiment; it does not run on its own. |
freerecall | Performs a free recall test. Allows for a particular minimum and maximum number of responses. Can return the words recalled and RTs, or save them to a file. |
FreeRecallScore | Scores the data from a free recall test against a list of targets. Allows the user to decide how to score particular intrusions, misspellings, etc. |
GetEchoStringCuedT4 | Prompts the subject to enter a word and returns the word & time taken. Optionally, a cue may be specified for cued recall. |
lenientcompare | Calculates a score from 0-100 of how similar two strings are; can be used to score recall data that might contain misspellings, etc. |
lenientcompareset | Uses lenientcompare to compare one string to a SET of possible matches and find the best match. |
LetterComparison | Task in which participant must make speeded judgments as to whether sets of consonants are identical or not. |
LetterSetCreate | Used internally by LetterComparison only. |
PatternComparison | Task in which participant must make speeded judgments as to whether line patterns are identical or not. |
PatternCreate | Used internally by PatternComparison only. |
AdjustVolume | Screen to allow users to adjust the volume before an experiment. |
antisaccade | Antisaccade task in which participants must saccade in the opposite direction of a peripheral cue. |
colordemo | Demo what various colors look like on this monitor. |
doIndividualDifferences | Used internally by IndividualDifferences.m only |
flanker | Classic flanker task. |
IndividualDifferences | Runs a battery of individual differences measures. |
InitExperiment | Start an experiment by defining colors and pixel size, and seeding random number generator. |
InstructionsScreen | Displays an instruction screen with the specified text. Forces the subject to spend time reading the instructions before they can advance. |
shipleyvocab | 40 item forced-choice vocab test. Auto-scored. Test items not included. |
Stroop | Short Stroop test with 2 blocked conditions: reading words, and then color naming. Automatically paced. |
StroopRT | Long Stroop test with 2 blocked conditions: naming colors of patches and words. Paced by participants, collects RT. |
vocab | Administers a multiple-choice vocabulary task. Test items not included. |
gupta | Pseudoword repetition task from Gupta (2003) |
BinaryQuestion | Asks a question with 2 choices. |
Likert | Asks a Likert scale question with a varying number of response options. |
OpenResponseQuestion | Asks a question with free response by participant. |
Questionnaire | Asks 2 basic demographics question: hometown & languages spoken. |
YesNoQuestion | Asks a yes/no question. |
compQ | Asks a reading comprehension question. |
movingwindow | Performs a self-paced moving window reading task on a sentence. |
movingwindowQ | Do a moving window item followed by a comprehension question. |
movingwindowTester | Tests the screen layout of moving window items by displaying the entire item on the screen at once. |
ResidReading | Calculate residual reading times from the output of movingwindow. |
CenterInRect | Returns the coordinates that would center a shape within a given region. |
DrawArrow | Draws an arrow from one point to another. |
DrawLineAnimated | Draw a line incrementally. |
FilledPoly | Draws a polygon filled with a color. |
FilledRect | Draws a rectangle filled with a color. |
FilledRectWText | Draws a colored rectangle and writes text in it. |
FramedRect | Draws the outline of a rectangle. |
FramedRectWText | Draws the outline of a rectangle and writes text in it. |
makeRadialGrid | Draws circles evenly arranged radially around the center of the screen. |
snapToBorder | Snaps an image to the border of a larger region. |
analyzeMarkupCode | Reads an HTML-style markup code and determines what code it is. |
asPercent | Converts a proportion to a percent. |
divideSentenceInTwo | Splits a string in half so that each half has an equal number of words. |
doubleToSingleSpacing | Converts double- and triple-spacing to single-spacing. |
extractNumbers | Extracts all the numbers from a string of text. |
extractTextFromLines | Given a cell array of lines of text, can extract a string that may span multiple lines. |
findInCellMatrix | Searches a cell array for a particular string, and returns a matrix indicating the location of all the matches. |
findUtteranceStart | Within a block of text, finds where a particular sentence started. |
getClosingTag | Determines the closing tag for a markup tag. |
getNextComplete Sentence | Reads the next complete sentence from an open file. |
initialsCapsOnly | Capitalizes the first letter of every word in a string, and puts everything else in lowercase. |
makeTextWidth | Adds space or truncates a string to make it fit a particular width. |
matchesInStringSet | Compares a string (or set of strings) to a cell array of strings and determines where a match is. |
num2strLZ | Converts a number to a string and adds leading zeros to force it to be a particular length. |
parseNumberList | Allows you to create a vector by describing it in a string, e.g. "1-3,5" -> [1 2 3 5] |
randTokens | Takes in a string that contains tokens separated by spaces and returns string that randomizes the order of the tokens (e.g., "This is a sentence" could return "is This sentence a") |
stripLeadingCharacter | Removes any instances of a particular character at the start of a string. |
stripManyStrings | Removes several different substrings from a given string. |
stripPunctuation | Removes all punctuation from a string. |
stripString | Removes all cases of a substring from a string. |
stripStringNum | Removes a portion of a string defined by its numerical starting and ending point. |
strrepMany | Within a string, makes multiple replacements of different substrings with other substrings. |
strrepNum | Replaces part of a string with something different, defined (unlike strtok) by numerical position. |
strtokMultiple | Completely divides a string into multiple tokens, based on a delimiter. |
wordCount | Counts the number of words in a string. |
File2Screen | Prints the contents of a text file to the screen. |
optimalTextSize | For a moving window experiment, finds the largest text size that allows every sentence in the experiment to fit on one line. |
WriteCentered | Writes text on the screen, centered at a particular point. Now runs onto multiple lines if needed. |
WriteLeft | Write left-aligned text on the screen. |
WriteLine | Write text on the screen, with word wrap. Includes options for paragraph breaks, double-spacing, and various font effects (e.g. boldface, italics, highlighting certain words in color). |
WriteRight | Write right-aligned text on the screen. |
GetEchoStringDisplay | Get text from the user, and display it as they're typing. Unlike PTB-3's GetEchoString, this can preserve what's already on the screen when you call the function. |
GetEchoStringFreeResponse | Asks a free response question to the participant |
inputnumber | Has the Matlab user enter a number within a particular minimum and maximum. |
inputstring | Forces the Matlab user to enter a non-empty string. |
inputyn | Gets an answer to a yes/no question from the Matlab user. |
CreateOffWin | Open a new offscreen window and set its font and color properties. |
GetRefresh | Returns your monitor's refresh rate. |
monitorsize | Calculates the physical dimensions of your monitor. |
pixels2visangle | Converts a measure of pixels from center to visual angle. |
visangle2pixels | Converts a measure of visual angle to pixels from center. |
visangle2width | Converts a measure of visual angle to physical distance. |
width2visangle | Converts a measure of physical distance to visual angle |
alphabetspan | Subject must recall words in alphabetical order. |
listeningspan | Listen to sentences, make true/false judgments, and recall the last word from each sentence. |
lspan | Listen to sentences, make true/false judgments, and recall intervening letters. |
minus2span | Recall a set of numbers in order while subtracting 2 from each |
ospan | Judge the answers to arithmetic equations and recall intervening letters. |
readingspan | Read sentences aloud, make judgments, and recall the last word from each sentence. |
rspan | Read sentences aloud, make judgments, and recall intervening letters. |
wmbattery | Administers the alphabetspan, listeningspan, minus2span, and readingspan tasks. Automated scoring. |