MOLE Modifiable Language Experiments

readTrialList Instructions


This function opens a specified file and formats it into an array of n rows by 14 (or more) columns that can easily be read by MATLAB.


This function will take the name of a file as an argument, and open the file into an array, labeled as “trialArray” in the format specified by the user.  If no format is specified, the function will default to 1 column of numbers, and 13 columns of text.

trialArray is organized so that each column of the originally opened data file is its own array, which can be indexed via curly braces {}.  To access a particular column of data, the user would enter trialArray{n}, where n specifies the number of the column desired.  For example, the user would enter trialArray{1} to access the first column.

If a particular cell in the array is desired, an additional set of curly braces can be used to index a particular row in the specified column.  For example, the user would enter trialArray{1}{4} to access the fourth row in the first column.


readTrialList(trialsfile, moreFormatting)

Ex.  readTrialList(‘ExpATrials’,’%s%s%s’)

OR (this is the same function as the one listed above, only using the defined variable names listed below in the Arguments section):

Ex.   readTrialList(arg1,arg2)


trialsfile: The name of the file to be loaded.
Ex.  arg1 = ‘ExpATrials’

moreFormatting: Optional character string denoting additional columns (e.g. ‘%s%s%s’ would be three additional columns of strings).
Ex.  arg2 = ‘%s%s%s’


This function cannot be formatted to have fewer than 14 columns via the moreFormatting argument.  If the user wants to format with fewer columns, the function itself would have to be altered (see program coding comments).

‘CommentStyle’,’%’ applies MATLAB’s default commenting system to the data file (e.g. “%This is a comment!” will not be read as part of the code when added to any information from this data file), but ONLY if the comment is added at the end of the set of columns.  This will NOT work if the comment is inserted in the middle of the specified number of columns.

All string inputs are case sensitive.


If you would like to download this read-me to your computer, you can do so below (right-click and ‘Save As’).

Comments are closed.

Post Navigation