error in reading csv files in matlab on cluster, Error using importdata (line 139) Unable to open file. , Error in run (line 91) evalin('caller', strcat(script, ';'));

4 vues (au cours des 30 derniers jours)
importing the CSV file in windows works fine
tUnProc = importdata ('Target.csv'); % import training targets
when I submit the matlab code into the cluster there will be error
< M A T L A B (R) >
Copyright 1984-2020 The MathWorks, Inc.
R2020a Update 1 (9.8.0.1359463) 64-bit (glnxa64)
April 9, 2020
To get started, type doc.
For product information, visit www.mathworks.com.
>> {Error using importdata (line 139)
Unable to open file.
Error in check_the_reading_of_MLP (line 8)
tUnProc = importdata ('Target.csv'); % import training targets
Error in run (line 91)
evalin('caller', strcat(script, ';'));
}
>>

Réponses (1)

Walter Roberson
Walter Roberson le 10 Fév 2021
filename = 'Target.csv';
if exist(filename, 'file')
fprintf('Okay, exist thinks it is there\n');
else
fprintf('Exist does not think it is there\n');
end
[fid, message] = fopen(filename, 'r')
if fid < 0
fprintf('fopen fails saying "%s"\n', message);
else
fprintf('fopen works!\n');
fclose(fid);
end
[folder, basename, ext] = fileparts(filename);
dinfo = dir(fullfile(folder, [basename, '.*']));
if isempty(dinfo)
fprintf('dir does not find any files with the same base name and any extension\n');
else
fprintf('dir finds some files with the same basename. Available files are:\n');
celldisp({dinfo.name});
end
dinfo = dir(fullfile(folder, ['*' ext]));
if isempty(dinfo)
fprintf('dir does not find any files with any name and the same extension\n');
else
fprintf('dir finds some files with the same extension. Available files are:\n');
celldisp({dinfo.name});
end

Catégories

En savoir plus sur Adding custom doc dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by