PDA

View Full Version : MovAlyzeR External Application Interface to Matlab



Somesh
2008-10-21, 15:54
MovAlyzeR records x,y coordinate data and pressure, tilt(optional) and stores them in .hwr files. These are simple space separated ASCII files and can be read into Matlab or any other programming environment.

Provided is a rudimentary example of how to read a raw hwr data file from MovAlyzeR into Matlab. Please check back soon for Matlab functions to read other files output from MovAlyzeR (tf, seg, ext, inc etc)


% This Matlab program reads the raw x,y,z and tilt data (azimuth and altitude)
% from the .hwr file recorded by MovAlyZeR(c). This data file can be accessed at the location
% UserRootDir\Experiment\Group\Condition\Subject\[.hwr file]

hwrdata = dlmread('C:\USR\EXP\GRP\CON\SUB\EXPGRPCONSUB01.HWR ');

% The columns of hwrdata have the raw coordinates, pressure and tilt information
x = hwrdata(:,1);
y = hwrdata(:,2);
z = hwrdata(:,3);
tilt_azimuth = hwrdata(:,4); <=== To record Azimuth and Altitude: Rightclick yoru experiment >Properties >Input Device >Record Tilt: CHECK
tilt_altitude = hwrdata(:,5);

% Now you can use the data as you like...
% eg : Plot x vs y
plot(x,y);

Somesh
2009-07-14, 15:57
The following is a straightforward implementation of reading .TF files into Matlab, then writing them to a Microsoft Excel spreadsheet.


function tfparse(filename)
% This program parses a .tf file (output from Movalyzer) and saves the
% data in an Excel readable file.

fin = fopen(filename,'r');
% Read line-by-line. Number of parameters is fixed for simplicity.
for i=1:18
% Strip the header and append
header = strread(fgetl(fin),'%s','delimiter',' ');
total_dat(1,i) = header(2);
% Read data and form array
total_dat(2:1+str2num(cell2mat(header(1))),i) = strread(fgetl(fin),'%s','delimiter',' ');
end

% Open output file and write data
xlswrite([filename(1:end-3) '.xlsx'],total_dat);

fclose('all');

Somesh
2009-07-14, 16:19
Extracted data in MovAlyzeR is stored in a .EXT file. Like all MovAlyzeR files, this is an ascii-delimited file and can be readily imported into Matlab using the following command


extdata = dlmread('UserRootDir\EEE\GGG\SSS\EEEGGGSSSCCCNN.EX T');

where
EEE = Experiment ID,
GGG = Group ID,
SSS = Subject ID,
CCC = Condition ID and
NN = Trial number

Somesh
2010-08-11, 17:58
In the \\stimuli folder within the experiment folder lie the stimulus target files with extension .TGT

The .TGT files give the boundaries of the stimulus element. To read in the values from this file, simply use


tgtdata = dlmread('\\stimuli\STI.TGT');

where STI is the stimulus name.

Array 'tgtdata' now has the contents of the .TGT file which may be accessed individually.