diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 448fa510cb8f277cdacfcaab00d1ec118cc5ff58..1843f8d2b4915fdcedf7daa59ad4cb60d1ac76d7 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -92,14 +92,20 @@ switch options.Method [~, idx] = PlotID.fileCompare(DataPaths.rdata{i},fList); % create Linked HDF5 files for identical files if any(idx) - sourcePath = fList{idx,'name'}; % If there are multiple copies already, this only picks the last entry - if contains(sourcePath,{'.h5','.hdf5'}) % Linking only for HDF5 - PlotID.createLinkedHDF5(sourcePath,storPath,ID); - end + sourcePath = fList{idx,'name'}; % If there are multiple copies already, this only picks the last entry + if contains(sourcePath,{'.h5','.hdf5'}) % Linking only for HDF5 + PlotID.createLinkedHDF5(sourcePath,storPath,ID); + end else % no identical file exists - PlotID.createFileCopy(DataPaths.rdata{i},'data',storPath,ID,'dataCentral'); - end - end + %Copy the file in data + PlotID.createFileCopy(DataPaths.rdata{i},'data',storPath,ID,'dataCentral'); + %WIP +% if contains(DataPaths.rdata{i},{'.h5','.hdf5'}) % Linking only for HDF5 +% % and create linked files in the plot folder +% PlotID.createLinkedHDF5(DataPaths.rdata{i},storPath,ID); +% end %if + end %if + end %for case 'individual' % Create a copy of the research data PlotID.createFileCopy(DataPaths.rdata,folderName,storPath,ID, 'data'); diff --git a/+PlotID/createFileCopy.m b/+PlotID/createFileCopy.m index e10a1d9d3f9f9823ce9f788b90bce25a54537653..c77e3551ce3bd6bfb415fa7445af1f9f1b2d537e 100644 --- a/+PlotID/createFileCopy.m +++ b/+PlotID/createFileCopy.m @@ -14,9 +14,11 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type) [~,name,ext] = fileparts(filePaths{i}); % get the extension switch type - case 'data' - sufix = '_data'; - newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]); + case 'data' + newfile = sprintf([name,ext]); %keep original name + %old behaviour + %sufix = '_data'; + %newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]); case 'dataCentral' %keep original name newfile = sprintf([name,ext]); diff --git a/+PlotID/createLinkedHDF5.m b/+PlotID/createLinkedHDF5.m index 17ad29de36e5613975a17afaf4a0d3f9afadf731..5e6e71c4fc754eaa016735d67ac50035060de61a 100644 --- a/+PlotID/createLinkedHDF5.m +++ b/+PlotID/createLinkedHDF5.m @@ -10,11 +10,17 @@ if iscell(SourceFile) SourceFile = SourceFile{1}; end +[~,filename,ext] = fileparts(SourceFile); + % try - fid = H5F.create(fullfile(TargetPath,ID,[ID,'_data.h5'])); + %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'); diff --git a/+PlotID/fileCompare.m b/+PlotID/fileCompare.m index 9ccebddfe77f08b2e92baf18cc42adbc4ea946fc..5e07704d70a12cc3c985d28700b95d20b1bfb2bd 100644 --- a/+PlotID/fileCompare.m +++ b/+PlotID/fileCompare.m @@ -24,7 +24,14 @@ for i=1:height(fileList) end filepath = fullfile(fileList{i,'folder'},fileList{i,'name'}); + + + %% old + %crucial performance due to matlab bug + %(see + %https://de.mathworks.com/matlabcentral/answers/338553-performance-of-system-dos-function) if ispc + filename = ['"',filename,'"'];% Bugfix for spaces in path [status,~] = system(['fc ' filename ' ' char(filepath)]); % 0 -> identical, 1 -> not identical status = ~status; % false (not identical), true(identical) @@ -34,9 +41,12 @@ for i=1:height(fileList) else warning('Platform not supported') end + %% if status == 1 id(i) = 1; + id =logical(id); %bugfix + return; else % Status can also be any other number e.g. 2 id(i) = 0;