Skip to main content

Transforming the understanding
and treatment of mental illnesses.

Celebrating 75 Years! Learn More >>

Laboratory of Neuropsychology (LN)

Exporting Results

Extracting data from MatOFF

TheDump,Set,Makdat, andReadcommands generate ASCII text files of raw or processed data. These ASCII files are the simplest method for moving data fromMatOFFto other computer programs. AHistory scriptis a more flexible way to export data, but requires some MATLAB programming. For experienced MATLAB programmers, using a History script is probably the best approach.

Various types of files can be generated with theSet <process> keepcommand. The process selected determines the type of data stored. Data are stored each time aShow,Old plot, orNew plotcommand is executed. If you use the default settings, the file name of the stored file includes a numeric value that is incrementing each time a file is stored. The file extension matches the data type. As an alternative to the numeric file names, theSetcommand has aSet <process> keep <filename>format for setting the file name. In this form of the command the user (usually via a protocol file) is responsible for changing the file name when necessary. When a file name is specified, the user can use theSet <process> appendcommand to build a single long file thatMatOFFappends to each time theShow,Old plot, orNew plotcommand is executed.Close appendis used to close the file after all the data are appended.

In addition to controlling the file names, there is a method for controlling the format of stored ASCII files. The format is specified in format files (.FMT files). .FMT files control the precision and column spacing for numeric values, and turn on or off some of the column headings and summary information. The format of each format file is listed below for each process. If no .FMT file exists for a process when that process is used, a default format is used. The .FMT files must be in the FORMATPATH if it exists, or the DEFAULTPATH otherwise. SeeEnvironmental variablesfor more information about setting these two path variables.

TheDumpcommand is the simplest way to storeMatOFFinformation to an ASCII file. It has very limited formatting options (using environmental variables). Some of theDumpcommands overlap with some of theSetcommand processes. Other operations, likeDump setstatsare only available through theDumpcommand.

Makdatis the preprocessor for Cortex files. It has powerful options for generating ASCII disk files of events, spikes, and analog values.

TheReadcommand can save event, spike, and analog values to disk using the 'out=' or 'append=' options.

<>Format files used by the Set command

SORT.FMT MWU.FMT EPOCH.FMT SEGSTAT.FMT

Format files are themselves ASCII files. Each line in a format file includes a keyword; some lines include parameter(s). If a keyword is omitted, then the corresponding element of the output file is omitted altogether. Certain keywords are common to most format files so they are described here first.

# Comment. Remainder of line is ignored.

HEADER

Information normally included before columnar data. Text from the DUMPLABEL environmental variable goes here along with other information.

TRAILER

Information normally included after columnar data.

DELIMITER

A single ASCII character used to separate data. A delimiter is typically used on columnar data when the column width is set to zero. Columns are separated on each line by the delimiter. With a zero column width each entry has a variable length, which means that columns do not necessarily line up. Be careful when trying to specify a delimiter; some editors do not insert a tab character (ASCII 09) into the text file when you hit the tab key.

VALUE:<width>:<precision>

Any keyword with ":<width>:<precision>" parameters describes one column of data. The width parameter sets the total column width. By setting this value large enough it can control the number of blank spaces between columns. A value of zero creates a variable-width column (see DELIMITER, above). The precision value is the number of digits after a decimal point. Precision is only present on floating point data columns. The effects of formatting can be tricky. Consult a MATLAB or C language reference on printf formatting.

SORT.FMT

Command that produces the ASCII file

Extension of ASCII file

Name of format file

Set Sort Keep/Show

.SRT

SORT.FMT

Format file format

Comments

Default format

HEADER
DELIMITER '<char>'
VALUE:<width>:<precision>
UNSORTED: <width>
ORDINAL:<width>
FORMAT <field>,<field>,...

pulses per second unsorted trial number
sorted trial number
see SEGSTATS

Default .SRT file:

HEADER
DELIMITER: ','
VALUE:5:2
UNSORTED:3
ORDINAL:3
FORMAT ORDINAL, UNSORTED, VALUE

Example output from this format:

23-Apr-2001 14:08:29
1,3,53.23
2,10,48.11
3,1,29.01
4,8,28.42
5,9,27.27
6,2,25.12
7,7,10.73
8,4,0.0
9,5,0.0
10,6,0.0

MWU.FMT

The MWU format is used only if automatically file numbering is tuned off or ifSet mwu appendis active. In these two cases only one mwu file is created with eachShowcommand. Otherwise, the MWU format is ignored and two files are created, one for each segment, with eachShow command.

Command that produces the ASCII file

Extension of ASCII file

Name of format file

Set MWU Keep/Show

.MWU

MWU.FMT

Format file format

Comments

Default format

HEADER
TRAILER
DELIMITER '<char>'
TRIAL:<width>:<precision>
ACOUNT:<width>:<precision>
BCOUNT: <width>:<precision>
FORMAT <field>,<field>,...

column: trial
column: A count
column: B count
see SEGSTATS

Example .MWU format file:

DELIMITER:' '
TRIAL:3
SEGA:3.1
SEGB:3.1
FORMAT SEGA, DIRECTION1 ,SEGB

Example output from this format:

1 22.2 DIRECTION1 18.2
2 31.2 DIRECTION1 19.8
3 4.4 DIRECTION1 20.1
4 12.1 DIRECTION1 14.4

EPOCH.FMT

Command that produces the ASCII file Extension of ASCII file Name of format file
Set EPOCHSTATS Keep/Show .EPK EPOCH.FMT
Format file format Comments Default format
HEADER
TRAILER
DELIMITER '<char>'
TRIAL:<width>
COUNT:<width>:<precision>
DTIME: <width>:<precision>

IPS: <width>:<precision>
FORMAT <field>,<field>,...
trial
number of spikes
time between center and mark codes (ms)
impulses/sec
see explanation
HEADER
TRAILER
' ' (blank)
0
0:2
0:2

0:2
TRIAL ,COUNT, DTIME, IPS

The keyword "FORMAT" followed by a list of comma separated field names defines the order of the segment data columns. The reserved field names "TRIAL", "COUNT", "DTIME", and "IPS" can be used as well as any constant strings.Note: spaces are not to be used before the reserved field names. A space will cause the reserved field name to not be recognized as a reserved field. Spaces used preceding and following non-reserved constant data will be printed with the constant data. This will probably not give you what you expect:

FORMAT TRIAL , COUNT , IPS

You will have better luck with:

FORMAT TRIAL ,COUNT ,IPS (no spaces between comma and reserved field)

Example epoch.fmt file:

HEADER
DELIMITER: ','
TRIAL:
COUNT::0
DTIME::0
IPS::1
FORMAT TRIAL,COUNT,IPS

Example output from this format file:

23-Apr-2001 14:08:29
2,0,0.0
12,0,0.0
18,0,14.7
24,0,20.2
19,0,13.9
20,0,11.1
10,0,0.0
4,0,0.0
25,0,29.8

We can add a constant string in the FORMAT statement to mark the condition associated with these trials:

epoch.fmt:

DELIMITER:
TRIAL:
COUNT::0
DTIME::0
IPS::1
FORMAT TRIAL,COUNT,IPS,COND1

Output:

2,0,0.0,COND1
12,0,0.0,COND1
18,0,14.7,COND1
24,0,20.2,COND1
19,0,13.9,COND1
20,0,11.1,COND1
10,0,0.0,COND1
4,0,0.0,COND1
25,0,29.8,COND1

SEGSTAT.FMT

Command that produces the ASCII file

Extension of ASCII file

Name of format file

Set SEGMENTSTATS Keep/Show .SEG SEGSTAT.FMT
Format file format Comments Default format
HEADER
TRAILER
DELIMITER '<char>'
TRIAL:<width>
SEGA:<width>:<precision>
SEGB: <width>:<precision>
FORMAT <field>,<field>,...



trial
column: segment A
column: segment B
see explanation

The keyword "FORMAT" followed by a list of comma separated field names defines the order of the segment data columns. The reserved field names "SEGA", "SEGB", "SEGX", and "TRIAL" can be used as well as any constant strings.Note: spaces are not to be used before the reserved field names. A space will cause the reserved field name to not be recognized as a reserved field.Spaces used preceding and following non-reserved constant data will be printed with the constant data. The SEQUENCE line without the commas will be printed for each row of the segment output. The reserved field names will be replaced with the actual data for the given row. This is all better explained by example.

Example:

Output for FORMAT TRIAL,SEGA,SEGB

will appear as

TRIAL A B
1 2.1 3.2
2 1.1 0.0
3 3.4 2.4

Output for FORMAT TRIAL,SEGX

will appear as

1 2.1
2 1.1
3 3.4
1 3.2
2 0.0
3 2.4

You can see that it goes through 1 iteration with SEGX = segment A and then another iteration with SEGX = segment B.

Output for FORMAT SEGA, DIR 1 ,SEGB

will appear as

2.1 DIR 1 3.2
1.1 DIR 1 0.0
3.4 DIR 1 2.4

The Header does not change to match the sequence, so it should not be used when setting the FORMAT. The other variables are used to set the width of the reserved field columns and the optional separator character.

EVENTS.FMT

Command that produces the ASCII file

Extension of ASCII file

Name of format file

Set EVENTS Keep/Show

.EVT

EVENTS.FMT

Format file format Comments Default format
HEADER
DELIMITER '<char>'
TRIAL:<width>
EVENTS:<width>
FORMAT <field>,<field>,...


trial
list of event codes
see explanation

The keyword "FORMAT" followed by a list of comma separated field names defines the order of the segment data columns. The reserved field names "EVENTS", and "TRIAL" can be used as well as any constant strings.Note: spaces are not to be used before the reserved field names. A space will cause the reserved field name to not be recognized as a reserved field.Spaces used preceding and following non-reserved constant data will be printed with the constant data. The SEQUENCE line without the commas will be printed for each row of the segment output. The reserved field names will be replaced with the actual data for the given row. This is all better explained by example.

Example:

Output for FORMAT UNIT101, TRIAL, EVENTS

will appear as

UNIT101 1 81 14 15 47
UNIT101 2 84 14 15 47
UNIT101 3 85 14 15 47

>Changing format files on the fly

Format (.FMT) files can be changed on the fly using the

Open,

Write, and

Close ascii

commands.

Here is an example.

set epochstats keep
set epochstats filename both_condx.txt
open ..\formats\epoch.fmt
write COUNT:3:1
write IPS:3
write FORMAT TRIAL, COND_1 ,COUNT,IPS
close ascii
trials 1-6
show
open ..\formats\epoch.fmt
write IPS:3.1
write FORMAT TRIAL, COND_2 ,COUNT,IPS
close ascii
trials 7-12
show

In this example trials 1-6 are associated with condition 1 (COND_1) and trials 7-12 are associated with condition 2 (COND_2). The original trial numbers, spike counts, and impulses per second are saved in the file "both_condx.txt," along with a column that labels the condition number.

1 COND_1 18 4.2
2 COND_1 23 5.4
3 COND_1 19 4.0
4 COND_1 0 0.0
5 COND_1 0 0.0
6 COND_1 0 0.0
7 COND_2 44 12.2
8 COND_2 24 5.4
9 COND_2 11 2.1
10 COND_2 0 0.0
11 COND_2 0 0.0
12 COND_2 0 0.0