이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Code not working on new laptop
조회 수: 104 (최근 30일)
이전 댓글 표시
Lucie Aman
2024년 7월 2일 22:24
Hello,
I have several scripts using EEGlab and one of its pluggin (mffimport). The scripts work well on other mac laptops (I've tried 3), but not on my new laptop (Macbookpro sonoma nov 2023). Any idea why?
I have changed the paths, dowloaded the necessarry toolboxes.
I have contacted EEGlab support who told me it's a matlab problem and I have contacted Matlab support who told me it is a code problem, not a software problem, but my code works well on other laptops...
THank you in advance for your help.
댓글 수: 12
Stephen23
2024년 7월 3일 3:58
편집: Stephen23
2024년 7월 3일 4:22
"Any idea why?"
Most likely because of your code, MATLAB, or your computer.
But because you did not give us any concrete information to help you (e.g. warning messages, error messages, the versions involved, the input values used, an MWE, a description of the observed behavior) we are limited to giving you a very general response to your very general question.
Lucie Aman
2024년 7월 3일 10:31
편집: Walter Roberson
2024년 7월 8일 18:55
thank you. I haven't given any details because I have multiple errors when I try to shunt some steps of the code using the GUI.
The main script is calle pipelineMMN.m the first section establishes the directory and the path to the folder (loadpathMMN.m). The second section calls EEGlab and the MFFImport plugin to import the PiPWS_PWS023.mff file. The third section filters (this works) and epochs(doesn't work) the continuous EEG recording calling the script epoch_MMN.m
- Let's start with the first error: I am using a script calling EEGlab and the MFFImport plugin to import mff files and convert them to get a .set and a .fdt file.
the error is Undefined function 'pop_mffimport' for input arguments of type 'char'.
Error in dataimport_MMN (line 16)
EEG = pop_mffimport(sprintf('%s%s', filepath, filename), 'code'); %needs MFFMatlabIO2.01 plugin
Error in pipelineMMN (line 49)
dataimport_MMN(basenames{i}, raw_dir)
I have tried to uninstall EEGlab and the MFFimport plugin, put them in different folders, but it seems that matlab doesn't recognise the function.
- The second error when I import the file manually and try to epoch my EEG file, is the following:
Error using pop_epoch (line 279)
pop_epoch(): empty epoch range (no epochs were found).
Error in epoch_MMN (line 114)
EEG = pop_epoch(EEG,{},opt.timewindow,'eventindices',selectevents);
Error in pipelineMMN (line 58)
epoch_MMN(basenames{i}, 'indir', imp_dir, 'outdir', epo_dir, 'timewindow', [-0.1 0.6], 'lpfreq',
20)
It seems matlab cannot find epochs, but when I check using the GUI, I can see the epochs markers.
Many thanks for your help.
Stephen23
2024년 7월 3일 10:58
"but it seems that matlab doesn't recognise the function."
Check that the MFFImport folder is on the MATLAB search path.
Lucie Aman
2024년 7월 3일 11:24
I have added it to the path in right clicking on the folder and selected add folder and subfolder. Should I do anything different?
Andreas Goser
2024년 7월 3일 15:40
I recommend to check (again) if the different machines run the exact same code. I know it might be cumbersome debugging, but in my experience this is likely.
Stephen23
2024년 7월 3일 17:02
편집: Stephen23
2024년 7월 3일 17:03
"I have added it to the path in right clicking on the folder and selected add folder and subfolder."
After adding the MFFimport folder to the search path:
- check that pop_mffimport can be called from the command line,
- call dbstop if error, run your code, check the search path after the error occurs (e.g. using path).
Lucie Aman
2024년 7월 8일 11:51
The pop_mffimport function can be called from the command line.The problem seems to come from finding events (= epochs). I have highlighted the problematic line in the code below.
function dataimport_MMN(mfffiles, indir)
% Import mff files
dbstop if error
filepath = [indir filesep];
basename = mfffiles(1:19);
if isempty(mfffiles)
error('No files found to import!\n');
end
filename = mfffiles;
fprintf('\nProcessing %s.\n\n', mfffiles);
EEG = pop_mffimport(sprintf('%s%s', filepath, filename), 'code'); %needs MFFMatlabIO2.01 plugin
%Add marker at 5th tone (move to 600ms because S1@0ms, S2@150ms,
%S3@300, S4@450, S5@600ms)
fprintf('Adding markers to 5th tone.\n');
events = {'LAX', 'LAY', 'LBX', 'LBY', 'RAX', 'RAY', 'RBX', 'RBY'};
EEG.eventOrig = EEG.event; This is the bit not working
f = fieldnames(EEG.eventOrig)';
f{2,1} = {};
EEG.event = struct(f{:});
c = 1;
for q = 1:length(EEG.eventOrig)
cont = contains(events, EEG.eventOrig(q).type(1:3));
if (sum(cont))==1 % istrue fct but doesn't work anymore%
EEG.event(c) = EEG.eventOrig(q);
c = c+1;
EEG.event(c) = EEG.eventOrig(q);
EEG.event(c).type = [EEG.event(c).type '_5'];
EEG.event(c).latency = EEG.eventOrig(q).latency + 600*(EEG.srate/1000); %onset of 5th sound is 600ms after onset of 1st
c = c+1;
else
EEG.event(c) = EEG.eventOrig(q);
end
end
EEG.setname = sprintf('%s_orig',basename);
EEG.filename = sprintf('%s_orig.set',basename);
EEG.filepath = filepath;
loadPathMMN;
fprintf('Saving %s%s.\n',[filepath '/Analysis/Imported/'], EEG.filename);
pop_saveset(EEG,'filename', EEG.filename, 'filepath', [filepath '/Analysis/Imported'],'version','7.3');
Steven Lord
2024년 7월 8일 14:04
What happens when you run the "problematic line"?
- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
Lucie Aman
2024년 7월 8일 15:38
Thank you Steven for your reply.
when I run the import section of my main pipeline script (pipeline_MMN), it calls a script called dataimport_MMN. Please see below the full error message when I try to run the import section of pipeline_MMN
Processing PiPWS_PWS023_GloLoc.
Make sure you call this function with the full MFF ressource path name ******
Error using mff_importsignal (line 218)
Error: Can not open the signal resource.\n
Error in mff_import (line 85)
[floatData, allDataSize, srate, nchans] = mff_importsignal(mffFile);
Error in pop_mffimport (line 65)
EEG = mff_import(fileName);
Error in dataimport_MMN (line 16)
EEG = pop_mffimport(sprintf('%s%s', filepath, filename), 'code'); %needs MFFMatlabIO2.01 plugin
Error in pipelineMMN (line 49)
dataimport_MMN(basenames{i}, raw_dir)
Stephen23
2024년 7월 8일 15:54
Compare the search path before and after the error occurs. Does it change? If so, find out where.
Stephen23
2024년 7월 9일 17:25
편집: Stephen23
2024년 7월 9일 21:07
Follow these steps:
- Try calling the function (from the command line in normal mode)
- Save the path in a MAT file.
- Call DBSTOP IF ERROR
- Run the code
- Try calling the function (from the command line in debug mode)
- Save the path in a MAT file.
- Upload the MAT files here.
- Lets us know the results of each previous step.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)