Borrar filtros
Borrar filtros

Not finding file using pop_loadbv function

32 visualizaciones (últimos 30 días)
Véronique
Véronique el 20 de Feb. de 2023
Editada: Walter Roberson el 8 de Ag. de 2023
Hi,
I'm using EEGLab and I'm having an issue. Indeed, I'm trying to load a vhdr files in order to preprocess datas. However, an error message occurs each time. The error message goes as followed: "Error using fopen; Unable to find file. Ensure file exists and path is valid." Here's the script below. Thanks !
%% Clear memory and the command window
clear;
clc;
% Initialize the ALLERP structure and CURRENTERP
ALLERP = buildERPstruct([]);
CURRENTERP = 0;
%% variables
subject_list = {'p24'};
nsubj = length(subject_list); % number of subjects
% Path to the parent folder, which contains the data folders for all subjects
home_path = 'C:\Users\maheuxca\Desktop\Donnees_Vero\Participants\EEG\participants_eeglab\';
% Loop through all subjects
for s=1:nsubj
fprintf('\n******\nProcessing subject %s\n******\n\n', subject_list{s});
% Path to the folder containing the current subject's data
data_path = [home_path subject_list{s} '\'];
sname = [data_path subject_list{s} '.vhdr'];
if exist(sname, 'file')<=0
fprintf('\n *** WARNING: %s does not exist *** \n', sname);
fprintf('\n *** Skip all processing for this subject *** \n\n');
else
fprintf('\n\n\n**** %s: formatting file ****\n\n\n', subject_list{s});
disp(data_path)
EEG = pop_loadbv('path', data_path,'hdrfile',[subject_list{s} '.vhdr']);
EEG.setname=[subject_list{s} '_raw'];
EEG = eeg_checkset( EEG );
EEG.setname = [EEG.setname '_raw'];
EEG = pop_saveset( EEG, 'filename',[EEG.setname '_raw.set'],'filepath',data_path);
EEG = eeg_checkset( EEG );
EEG = pop_loadset('filename', [subject_list{s} '_raw.set'], 'filepath', data_path);
EEG = pop_resample( EEG, 250);
EEG.setname = [EEG.setname '_rs'];
EEG = pop_saveset(EEG, 'filename', [EEG.setname '.set'], 'filepath', data_path);
end
end

Respuestas (1)

Shubh Dhyani
Shubh Dhyani el 28 de Feb. de 2023
Editada: Shubh Dhyani el 8 de Ag. de 2023
Hi Veronique,
I understand that you are getting an error “unable to find file” while using “pop_loadbv” function.
The error message indicates that the function pop_loadbv is unable to find the file specified by the variable sname, which is constructed as [data_path subject_list{s} '.vhdr']. Here are a few things you can check:
1. Make sure that the file exists in the directory specified by data_path. You can do this by navigating to that directory in the file explorer and confirming that the file is present.
2. Check that the file name is spelled correctly and matches the variable subject_list{s}. It is case-sensitive, so make sure that the capitalization matches exactly.
3. If the file is located in a subdirectory of data_path, make sure that you include the subdirectory name in the pop_loadbv function call. For example, if the file is in a directory called "data" within the subject's data directory, you would call pop_loadbv('path', [data_path 'data\'],'hdrfile',[subject_list{s} '.vhdr']).
4. Check that you have read permission for the file. You can try opening the file in a text editor to confirm that you can access it.
If none of these solutions work, it may be helpful to print out the value of sname to make sure that it is being constructed correctly. You can do this by adding the line disp(sname) before the call to “pop_loadbv”.
You can refer to this link for further information :
https://www.mathworks.com/matlabcentral/answers/580056-pop_loadbv-import-error

Categorías

Más información sobre Biomedical Signal Processing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by