Dear Steve,
You can use the load() function (or spm_load()):
onset_hit_behavior_selection = load('9008hO_onset.txt')
Note that you don't need to change directory before calling spm_select.
Best regards,
Guillaume.
On 18/12/2019 08:05, Steve Petersen wrote:
>
> Dear SPM´s
>
> What Matlab function uses SPM12 to read txt files? I am trying to create
> a Matlab script for the first level analysis and when I ran the script I
> received this error message
>
> 'first_level'
>
> Item 'Onsets', field 'val': Item must be an array of real numbers.
> Item 'Durations', field 'val': Item must be an array of real numbers.
> Item 'Onsets', field 'val': Item must be an array of real numbers.
> Item 'Durations', field 'val': Item must be an array of real numbers.
> Item 'Onsets', field 'val': Item must be an array of real numbers.
> Item 'Durations', field 'val': Item must be an array of real numbers.
> Error using spm_jobman>fill_run_job (line 472)
> No executable modules, but still unresolved dependencies or
> incomplete module inputs.
>
> Error in spm_jobman (line 247)
> sts = fill_run_job('run', cjob, varargin{3:end});
>
> Error in first_level_script (line 200)
> spm_jobman('run',matlabbatch);
>
>
> I checked all the paths and are OK. Moreover, when I put the
> "interactive" mode in the spm_jobman, that is, spm_jobman('interactive',
> matlabbatch) I noticed that all is ok except the .txt files. For each
> subject I have one .txt for onset and another .txt for durations. Both
> files are a simple column with numbers (please see attached). Below you
> can find the part of the script where I am trying to call a spm_function
> to read the txt files. I used spm_select but it seems that is not the
> correct ones.
>
>
>
> %%%% ONSET HIT CONDITION
>
>
>
> matlabbatch{1}.spm.stats.fmri_spec.sess.cond(1).name = 'HIT';
>
>
>
> cd(fullfile(dir_input,name_subj{s}))
>
> behavior_hit_onset_dir =
> fullfile(dir_input,name_subj{s},'behavioral_data','HIT_ONSET');
>
> behavior_hit_onset_dir_list =
> spm_select('FPList',behavior_hit_onset_dir,'.*\.txt$')
>
> onset_hit_behavior_selection = cellstr(behavior_hit_onset_dir_list);
>
>
>
>
>
> matlabbatch{1}.spm.stats.fmri_spec.sess.cond(1).onset =
> onset_hit_behavior_selection;
>
>
>
>
> Please, any suggestion would be very appreciated. Thanks in advance
>
>
>
> Best regards,
--
Guillaume Flandin, PhD
Wellcome Centre for Human Neuroimaging
UCL Queen Square Institute of Neurology
London WC1N 3BG
|