フィルターのクリア

Can't create hdf5 file using batch scripts.

4 ビュー (過去 30 日間)
Remington Reid
Remington Reid 2017 年 10 月 20 日
I'm trying to create an hdf5 file to store many large arrays. When I run my test script the lines,
file_name = strcat('/home/usr/test_results1');
h5create(file_name,'variable',[10, Inf],'ChunkSize',[10 1]);
work just fine. When I execute the script as a batch job I get a failure: "Unable to create file with specified filename. Filename may have unsupported characters".
Any thoughts?

回答 (2 件)

per isakson
per isakson 2017 年 10 月 20 日
編集済み: per isakson 2017 年 10 月 20 日
The function, strcat, has no effect in the statement
file_name = strcat('/home/usr/test_results1');
which is equivalent to
file_name = '/home/usr/test_results1';
If you want to combine parts to a file specification use fullfile, Build full file name from parts
I guess your problem is caused by the relative path; your current path isn't the same when you run interactively and with the script. The function, cd, shows the current path.

Mohammad Abu Zafer Siddik
Mohammad Abu Zafer Siddik 2019 年 8 月 1 日
編集済み: per isakson 2019 年 8 月 2 日
Hi,
I am getting the same error; Here is my code.
filename='A_B_C_1';
filename_r=fullfile([filename '.h5']);
filename_r(regexp(filename_r,'[_]'))=[]; % remove "_" from filename
fcpl = H5P.create('H5P_FILE_CREATE');
fapl = H5P.create('H5P_FILE_ACCESS');
fileID=H5F.create(filename_r,'H5F_ACC_TRUNC',fcpl,fapl);
Would you guys have any idea how can i solve this issue?
Error:
Error using hdf5lib2
Unable to create file with specified filename. Filename may have unsupported characters.
Error in H5F.create (line 40)
file_id = H5ML.hdf5lib2('H5Fcreate', varargin{:});
Thanks in advance
  3 件のコメント
Walter Roberson
Walter Roberson 2019 年 8 月 2 日
Instead of using regexp to remove the _ it would seem to make more sense to use
filename_r(filename_r == '_') = [];
Is that the exact filename you are using? The code works on my system.
Mohammad Abu Zafer Siddik
Mohammad Abu Zafer Siddik 2019 年 8 月 2 日
Thanks Walter, I really appreciate it.
Yes. Sometimes it works sometimes it don't work. Now it works for my system as well.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeHDF5 についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by