Load files from relative path
Ältere Kommentare anzeigen
function []= read_c3d_feat(output_list_relative)
% rather than fileread, importdata save each line separetely.
dir_list = importdata(output_list_relative);
dim_feat = 512;
for i = 1 : size(dir_list, 1)
dir_str = char(dir_list(i));
feat_files = dir([dir_str, '/*.res5b']);
num_feat = length(feat_files);
feat = zeros(num_feat, dim_feat);
for j = 1 : num_feat
feat_path = strcat(dir_str, '/', feat_files(j).name);
[~, feat(j,:)] = read_binary_blob(feat_path);
end
When i give input from command line like: read_c3d_feat('C:/Users/abc/Documents/MATLAB/features/0021.res5b')
Error using dir
Invalid path. The path must not contain a null character.
Error in read_c3d_feat (line 12)
feat_files = dir([dir_str, '/*.res5b']);
And When i give input from command line like: read_c3d_feat('C:/Users/abc/Documents/MATLAB/features')
Error using importdata (line 226)
Unable to load file.
Use TEXTSCAN or FREAD for more complex formats.
Error in read_c3d_feat (line 6)
dir_list = importdata(output_list_relative);
Caused by:
Error using fread
Invalid file identifier. Use fopen to generate a valid file identifier.
2 Kommentare
You question is unclear. In particular:
- your title asks about relative paths, but your question and examples only show absolute paths.
- you show examples where you call two different functions (once read_c3d_feat and once read_nvidia_c3d_feat), but you do not explain the difference, nor why you expect them to behave in the same way.
- The first error message explains clearly that there is an invalid character in the string. Please place this code exactly before that line, and show us what it displays when the error occurs:
+[dir_str, '/*.res5b']
Sanjay Saini
am 25 Mai 2017
Bearbeitet: Sanjay Saini
am 25 Mai 2017
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu File Operations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!