Select Git revision
createLinkedHDF5.m
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
createLinkedHDF5.m 928 B
function [status] = createLinkedHDF5(SourceFile,TargetPath,ID)
%createLinkedHDF5 creates a HDF file that references the Sourcefile
% TargetPath is the storage location, ID the foldername
% Status returns true if the function was sucessfull
plist_id = 'H5P_DEFAULT';
%catches error of wrong file type
if iscell(SourceFile)
SourceFile = SourceFile{1};
end
[~,filename,ext] = fileparts(SourceFile);
% try
%old
%fid = H5F.create(fullfile(TargetPath,ID,[ID,'_data.h5']));
fid = H5F.create(fullfile(TargetPath,ID,[filename,ext]));
%create External Link to Sourcefile in the Group linkToExternal
H5L.create_external(['..\data\',SourceFile],'/',fid, SourceFile ,plist_id,plist_id);
H5F.close(fid);
disp([fullfile(TargetPath,ID,[filename,ext]),' created']);
status = 1;
% catch
% warning('No linked HDF file was created');
% status = 0;
% end
end