Dear Jakob,
I could reproduce the error. It comes down to Arno's bug in
read_eeglabheader. I fixed the bug and the conversions completes
successfully. Put the attached file in /external/fileio/private. Let
me know if you have any additional problems.
Best,
Vladimir
On Wed, Jul 1, 2009 at 4:32 PM, Jakob Scherer<[log in to unmask]> wrote:
> sorry, i messed it up, it should read (read_eeglabdata.m, line 75ff)
>
> try
> pathstr = fileparts(filename);
> % assuming the .dat and .set files are located in the same directory
> fid = fopen([ pathstr filesep header.orig.data]);
> catch
> fid = fopen([ header.orig.filepath filesep header.orig.data ]);
> end
>
> Then the next error encountered is:
> -----------------------------------------------------------------------
> Running job #1
> -----------------------------------------------------------------------
> Running 'M/EEG Conversion'
>
> SPM8: spm_eeg_channelselection (v2866) 17:28:17 - 01/07/2009
> ========================================================================
> Warning: Could not obtain fiducials automatically.
>> In spm_eeg_convert at 410
> In spm_cfg_eeg_convert>eeg_convert at 231
> In matlabbatch\private\cfg_run_cm at 29
> In cfg_util>local_runcj at 1363
> In cfg_util at 699
> In cfg_ui>MenuFileRun_Callback at 1139
> In gui_mainfcn at 96
> In cfg_ui at 53
> checkmeeg: no channel type, assigning default
> checkmeeg: no units, assigning default
> checkmeeg: transform type missing, assigning default
> checkmeeg: data scale missing, assigning default
> checkmeeg: data type is missing or incorrect, assigning default
> creating layout from cfg.elec
> creating layout for ext1020 system
> Failed 'M/EEG Conversion'
> Index exceeds matrix dimensions.
> In file "P:\Science\Matlab\spm8\external\fieldtrip\private\prepare_layout.m"
> (???), function "prepare_layout" at line 608.
> In file "P:\Science\Matlab\spm8\external\fieldtrip\ft_prepare_layout.m"
> (???), function "ft_prepare_layout" at line 11.
> In file "P:\Science\Matlab\spm8\spm_eeg_project3D.m" (v3005), function
> "spm_eeg_project3D" at line 22.
> In file "P:\Science\Matlab\spm8\spm_eeg_prep.m" (v3005), function
> "spm_eeg_prep" at line 94.
> In file "P:\Science\Matlab\spm8\spm_eeg_convert.m" (v3088), function
> "spm_eeg_convert" at line 461.
> In file "P:\Science\Matlab\spm8\config\spm_cfg_eeg_convert.m" (v3059),
> function "eeg_convert" at line 231.
>
> The following modules did not run:
> Failed: M/EEG Conversion
> =======================================================================================
>
> i'll load up the dataset to reproduce the error
> thanks,
> jakob
>
>
> On Wed, Jul 1, 2009 at 5:13 PM, Jakob Scherer<[log in to unmask]> wrote:
>> dear vladimir,
>>
>> in read_eeglabdata.m, line 75:
>>
>> fid = fopen(header.orig.data);
>>
>> assumes that the files to be read in are located in the current matlab
>> directory.
>> one could change this into
>>
>> pathstr = fileparts(filename); % assuming the .dat and .set files are
>> located in the same directory
>> try
>> fid = fopen([ pathstr filesep header.orig.data]);
>> catch
>> fid = fopen([ header.orig.filepath filesep header.orig.data ]); %
>> which i personally find less intuitive, but more consistent with
>> eeglab
>> end
>>
>> to avoid this.
>>
>>
>> On Fri, Jun 26, 2009 at 7:08 PM, Vladimir
>> Litvak<[log in to unmask]> wrote:
>>> Dear Jakob,
>>>
>>> Could you send me the error message and the problematic dataset? You
>>> can use yousendit.com if it's too large.
>>>
>>> Best,
>>>
>>> Vladimir
>>>
>>> On Fri, Jun 19, 2009 at 3:08 PM, Jakob Scherer<[log in to unmask]> wrote:
>>>> hi,
>>>>
>>>> it seems to me that in
>>>>
>>>> spm_cfg_eeg_convert.m, line 37 should read:
>>>> usetrials.val = {1}; % instead of usetrials.val = {0},
>>>>
>>>> to match the default value defined in spm_eeg_convert.m
>>>> (from the help text:
>>>> % S.usetrials - 1 - take the trials as defined in the data [default]
>>>> % 0 - use trial definition file even though the data is
>>>> % already epoched)
>>>>
>>>>
>>>> Then, having corrected that, i get the following error:
>>>>
>>>> SPM8: spm_eeg_channelselection (v2866) 15:22:55 - 19/06/2009
>>>> ========================================================================
>>>> Failed 'M/EEG Conversion'
>>>> Invalid MEX-file
>>>> 'P:\Science\Matlab\spm8\@file_array\private\mat2file.mexw64': Invalid
>>>> access to memory location.
>>>>
>>>> .
>>>> In file "P:\Science\Matlab\spm8\@file_array\subsasgn.m" (v1355),
>>>> function "subfun" at line 132.
>>>> In file "P:\Science\Matlab\spm8\@file_array\subsasgn.m" (v1355),
>>>> function "subsasgn" at line 73.
>>>> In file "P:\Science\Matlab\spm8\spm_eeg_convert.m" (v3088), function
>>>> "spm_eeg_convert" at line 346.
>>>> In file "P:\Science\Matlab\spm8\config\spm_cfg_eeg_convert.m" (v3059),
>>>> function "eeg_convert" at line 231.
>>>>
>>>> The following modules did not run:
>>>> Failed: M/EEG Conversion
>>>>
>>>>
>>>> Thanks for any help,
>>>> regards, jakob
>>>>
>>>
>>
>
% read_eeglabheader() - import EEGLAB dataset files
%
% Usage:
% >> header = read_eeglabheader(filename);
%
% Inputs:
% filename - [string] file name
%
% Outputs:
% header - FILEIO toolbox type structure
%
% Author: Arnaud Delorme, SCCN, INC, UCSD, 2008-
%123456789012345678901234567890123456789012345678901234567890123456789012
% Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD, [log in to unmask]
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
% $Log: read_eeglabheader.m,v $
% Revision 1.2 2009/01/23 15:35:46 roboos
% create default channel names if EEG.chanlocs.labels is missing
%
% Revision 1.1 2009/01/14 09:12:15 roboos
% The directory layout of fileio in cvs sofar did not include a
% private directory, but for the release of fileio all the low-level
% functions were moved to the private directory to make the distinction
% between the public API and the private low level functions. To fix
% this, I have created a private directory and moved all appropriate
% files from fileio to fileio/private.
%
% Revision 1.2 2008/04/21 18:45:59 roboos
% fixed bug, ori should be orig
%
% Revision 1.1 2008/04/18 14:04:48 roboos
% new implementation by Arno, shoudl be tested
%
function header = read_eeglabheader(filename)
if nargin < 1
help read_eeglabheader;
return;
end;
if ~isstruct(filename)
load('-mat', filename);
else
EEG = filename;
end;
header.Fs = EEG.srate;
header.nChans = EEG.nbchan;
header.nSamples = EEG.pnts;
header.nSamplesPre = -EEG.xmin*EEG.srate;
header.nTrials = EEG.trials;
try
header.label = { EEG.chanlocs.labels }';
catch
warning('creating default channel names');
for i=1:header.nSamples
header.label{i} = sprintf('chan%03d', i);
end
end
ind = 1;
for i = 1:length( EEG.chanlocs )
if ~isempty(EEG.chanlocs(i).X)
header.elec.label{ind, 1} = EEG.chanlocs(i).labels;
% this channel has a position
header.elec.pnt(ind,1) = EEG.chanlocs(i).X;
header.elec.pnt(ind,2) = EEG.chanlocs(i).Y;
header.elec.pnt(ind,3) = EEG.chanlocs(i).Z;
ind = ind+1;
end;
end;
% remove data
% -----------
%if isfield(EEG, 'datfile')
% if ~isempty(EEG.datfile)
% EEG.data = EEG.datfile;
% end;
%else
% EEG.data = 'in set file';
%end;
EEG.icaact = [];
header.orig = EEG;
|