+ Reply to Thread
Results 1 to 4 of 4

Thread: MovAlyzeR External Application Interface to Matlab

  1. Somesh is offline Research and Development Engineer
    Join Date
    May 2008
    Posts
    628

    MovAlyzeR External Application Interface to Matlab

    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)

    Code:
    % 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);
    Last edited by Somesh; 2009-07-14 at 15:00.

  2. Somesh is offline Research and Development Engineer
    Join Date
    May 2008
    Posts
    628
    The following is a straightforward implementation of reading .TF files into Matlab, then writing them to a Microsoft Excel spreadsheet.

    Code:
    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');
    Last edited by Somesh; 2009-07-14 at 15:01.

  3. Somesh is offline Research and Development Engineer
    Join Date
    May 2008
    Posts
    628
    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

    Code:
    extdata = dlmread('UserRootDir\EEE\GGG\SSS\EEEGGGSSSCCCNN.EXT');
    where
    EEE = Experiment ID,
    GGG = Group ID,
    SSS = Subject ID,
    CCC = Condition ID and
    NN = Trial number

  4. Somesh is offline Research and Development Engineer
    Join Date
    May 2008
    Posts
    628

    .TGT files

    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

    Code:
    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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts