📄 readmarkerfile.m
字号:
%%%% <>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> %% < > % % < DISCLAIMER: > %% < > %% < THIS PROGRAM IS INTENDED FOR RESEARCH PURPOSES ONLY. > %% < THIS PROGRAM IS IN NO WAY INTENDED FOR CLINICAL OR > %% < OFFICIAL USE. > %% < > %% <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<> %%%%function [data] = readmarkerfile(folder);% function reads a CTF data file (.ds), Read 'markerfile.mrk' % marker is the read-only 'markerfile.mrk'% creates structure 'data' which contains number_markers, number_samples,% marker_names, trial_times, marker.a = exist(fullfile(folder,'MarkerFile.mrk'));if a == 0 disp(' '); disp('Error: Your data could not be found. MarkerFile.mrk does not exist in this directory.'); disp(' '); data = []; returnend % error message if incorrect directory is displayed markr = textread(fullfile(folder,'MarkerFile.mrk'),'%s','delimiter','\n');% creates markerfile.mrk in FOLDER directory. Type 'marker' to view.number_markers_id = strmatch('NUMBER OF MARKERS:',markr,'exact');markers = str2num(markr{number_markers_id+1});% defines markersnumber_samples_id = strmatch('NUMBER OF SAMPLES:',markr,'exact');samples = str2num(char(markr(number_samples_id+1)));% defines samplesfor i = 1:length(samples) if samples(i) == 0 disp('Error: one of the markers is bad.'); data = []; return endend name_id = strmatch('NAME:',markr,'exact');names = markr(name_id+1);% defines namestrial = strmatch('LIST OF SAMPLES',markr)+2;for i = 1:markers trials{i} = str2num(char(markr(trial(i):trial(i)+samples(i)))); trials{i}(:,1) = trials{i}(:,1) + 1;enddata = struct('number_markers',{markers},'number_samples',{samples},'marker_names',{names},'trial_times',{trials}); % defines data
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -