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, ';'));
2 次查看(过去 30 天)
显示 更早的评论
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, ';'));
}
>>
0 个评论
回答(1 个)
Walter Roberson
2021-2-10
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
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!