0001 function [ values, times, vertices ] = mne_label_time_courses(labelfile,stcfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 me='MNE:mne_label_time_courses';
0024
0025 if nargin ~= 2
0026 error(me,'Incorrect number of arguments');
0027 end
0028 try
0029 stc = mne_read_stc_file(stcfile);
0030 catch
0031 error(me,'%s',mne_omit_first_line(lasterr));
0032 end
0033
0034 try
0035 lab = mne_read_label_file(labelfile);
0036 catch
0037 error(me,'%s',mne_omit_first_line(lasterr));
0038 end
0039
0040 [vertices,ia,ib] = intersect(double(stc.vertices),double(lab.vertices));
0041 if length(vertices) == 0
0042 error(me,'No vertices match the label in the stc file');
0043 end
0044
0045 values = stc.data(ia,:);
0046 times = zeros(1,size(stc.data,2));
0047 for k = 0:length(times)-1
0048 times(k+1) = stc.tmin + k*stc.tstep;
0049 end
0050
0051 end
0052