LabNote: Open video files from MatLab in external program

Contents

Changelog

Initialize

clear all; close all; clc
version

Set path for external program

app     = '"C:\Users\tw\app\win\VirtualDub 1.6\VirtualDub.exe"';
% app   = '"C:\Program Files (x86)\Mikromak\WINanalyze3D\Wanalyze.exe"';

Set root for video data

datap = 'G:\archive\dat\120901_digitalization\';

Import metadata

exl = dataset('XLSFile','G:/tmp/metadata.xlsx','Sheet','Protokoll','range','A5:DZ2425');

Subsetting

filter = (char(exl.ant)       == 'F'  &  exl.deg==60 & exl.spattern ==  1);
s = exl(filter,exl.Properties.VarNames);
sum(filter); % display number of selected trials

Loop through video files, open in external program

for k = 1:length(s)

    % display progress
    disp([num2str(k),'/',num2str(length(s))])

    % copy relevant frame to clipboard
    % consider how external program counts frames
    frame = s.td_force_plate(k)-1;
    clipboard('copy',num2str(frame));

    % open video in external program
    id = s.id{k};
    eval(['!',app, ' ','"',datap,id,'\',id,'.avi"'])
end

Alternative: Open Digitizing Tool and relevant marker file

addpath('G:/DigitizingTools_20160711/');
for k = 1:length(s)

    % display progress
    disp([num2str(k),'/',num2str(length(s))])

    % copy relevant frame to clipboard
    % consider how external program counts frames
    frame = s.td_force_plate(k)-1;
    clipboard('copy',num2str(frame));
    id = s.id{k};
    cd([datap,id])
    edit(['HedrickLab_pt2marker.csv'])

    DLTdv6
    keydown = waitforbuttonpress;
    if (keydown == 0)
        close all
        continue
    end
end