Sha256: 76103442a38972bba13097e9af1bca52a585a20fcaf7d295db5fccfa88fe31ef

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

function [] = prepare_onsets_xls(csvfile, matfileprefix, conditions)
%IMPORTFILE(FILETOREAD1)
%  Imports data from the specified file
%  FILETOREAD1:  file to read

import_csv(csvfile);

for i = 1:length(conditions)
	condition = conditions{i};
	condition_onsets = eval(condition);
		
	% Strip NaN's, but leave one nan if vector is empty (SPM's preference).
	condition_onsets = condition_onsets(find(~isnan(condition_onsets)));
	
    % Allow for conditions called 'misses' to be dropped from onsets.
    if length(condition_onsets) == 0;
		if ~strcmp(condition, 'misses')
            condition_onsets=[nan];
        else
            continue
        end
	end
	
	% Format cell array for SPM's multiple conditions
	names{i} = condition;
	onsets{i} = condition_onsets;
	durations{i} = [0];
end

save([matfileprefix,'.mat'],'names','onsets', 'durations');

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rpipe-0.0.3 lib/matlab_helpers/prepare_onsets_xls.m
rpipe-0.0.2 lib/matlab_helpers/prepare_onsets_xls.m
rpipe-0.0.1 lib/matlab_helpers/prepare_onsets_xls.m