Sunday, September 30, 2007

My first m file script :)

Currently the NCP lab (human part) mainly uses DMDX to run standard cognitive psychology experiments. For those people who are interested in knowing further about DMDX, please refer to this site:

http://www.u.arizona.edu/%7Ejforster/dmdx.htm

My goal here is very simple: to make my life easier and hopefully graduate sooner than later. Today I just wrote my first m file so that I can directly extract the ID, Item Number, RT and COT information from the DMDX output .azk file. Since I'm new to Matlab programing, the script might not be written in the most elegant way to handle such tasks. However I consider this a good start (for myself) to learn programming better and make something useflul out of my time :)

The script turns the default azk output into a four column array saved in .txt format (tab delimited)

Before the conversion, the default azk output looks like this:

===================================

Subjects incorporated to date: 005
Data file started on machine PARK375NCP1

**********************************************************************
Subject 1, 09/18/2007 17:54:23 on PARK375NCP1, refresh 16.66ms, ID 1001
Item RT COT
10111612 3504.07 0.00
10111713 464.16 6681.79
10111522 -693.13 11897.25
10111722 786.34 17112.71
........

===================================

After the conversion, the txt file looks like this:

===================================

1001 10111612 3504.07 0.00
1001 10111713 464.16 6681.79
1001 10111522 -693.13 11897.25
1001 10111722 786.34 17112.71
........

===================================

This format (hopefully) is a lot easier to process in other programs such as Excel or SPSS (what I use currently).

The file is called "azk2txt_c.m". For novice Matlab users like myself, here's how I use the script:

(1). Place the file in a folder that's within your Matlab paths
(2). The azk file(s) to be converted should be in the same folder as azk2txt_c.m
(3). In the Matlab command line, type in azk2txt_c and hit enter (or open the m file and run the script)
(4). At prompt, enter the name of the azk file (without .azk)
(5). At prompt, enter the trail number for each subject (don't know how to get around this yet.... shouldn't be too difficult to make this step automatic. But as I said, I have very limited programing ability....)
(6). A extracted txt file will be automatically generated in your working folder. The default name for the txt file is azk_[the original filename].txt

Please download the file on the following page:

http://estellaliu.googlepages.com/resource

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home