diff --git a/example.m b/example.m index b160cbff3ecf7d5ee3cb5513bdd5dcbf0b6b571d..45c7e397413a2fced53e8923880947073218ffd5 100644 --- a/example.m +++ b/example.m @@ -45,8 +45,8 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]); [figs, ID] = TagPlot(fig, ProjectID); %% call dummy function -a=1; -a = test_2(a); +% a=1; +% a = test_2(a); %% publishing diff --git a/fcn_core/CreateID.m b/fcn_core/CreateID.m index 72917277e053ab63768986e7fb885bcb00f282f5..42ec2b29e9c2c041ecbe190175d07cf219deef02 100644 --- a/fcn_core/CreateID.m +++ b/fcn_core/CreateID.m @@ -20,6 +20,4 @@ switch method error('The requested method is not defined yet'); end - - end diff --git a/fcn_core/Publish.m b/fcn_core/Publish.m index 5e941ce615cbc6ce7ae0e878d2259f0258bdb74b..c970e7d9b198083e32602d7c6953fe18497f15e1 100644 --- a/fcn_core/Publish.m +++ b/fcn_core/Publish.m @@ -33,7 +33,7 @@ end disp('Publishing started'); -%% Create a Copy of the script and User functions +%% Create a Copy of the script and User functions(optional) createFileCopy({[DataPaths.script,'.m']},folderName,storPath,ID, 'script'); if options.CopyUserFCN @@ -52,12 +52,15 @@ switch options.Method %check if data folder exists if ~isfolder(fullfile(storPath,'data')) mkdir(fullfile(storPath,'data')); + else %list all files + fList = dir(fullfile(storPath,'data', '**\*.*')); %get list of files and folders in any subfolder + fList = fList(~[fList.isdir]); %remove folders from list end % Check if the new plot is based on the original data-set % copy the data(once) for i=1:numel(DataPaths.rdata) - if fileCompare(filename1,filename2) % identical file exists - createLinkedHDF5(SourceFile,storPath,ID) + if fileCompare(DataPaths.rdata{i},{fList.name}) % identical file exists + createLinkedHDF5(DataPaths.rdata{i},storPath,ID) else % no identical file exists createFileCopy(DataPaths.rdata{i},'data',storPath,ID,'data'); end diff --git a/fcn_help/FileCompare.m b/fcn_help/FileCompare.m index a4f735b862fde416cf309a614a40d4eb30aeee87..325cfe5e409469d39f064e7bf76402bd7a1ce30f 100644 --- a/fcn_help/FileCompare.m +++ b/fcn_help/FileCompare.m @@ -1,26 +1,36 @@ -function [status] = fileCompare(filename1,filename2) -%fileCompare checks if file1 is (binary) identical to file 2 +function [status, id] = fileCompare(filename,fileList) +%fileCompare checks if file1 is (binary) identical to a file in filelist +% it returns a sttus and the id of the identical file % the functions uses the windows system function fc or the unix function % diff -[~,~,ext1] = fileparts(filename1); -[~,~,ext2] = fileparts(filename2); +%% Not working!!! -if ~isequal(ext1,ext2) - %warning('File extension are not identical'); - status = false; - return -end +[~,~,ext1] = fileparts(filename); +id = zeros(numel(fileList),1); -if ispc - [status,result] = system(['fc ' filename1 ' ' filename2]); +for i=1:numel(fileList) + [~,~,ext2] = fileparts(fileList{i}); -elseif isunix %untested! - [status,result] = system(['diff ' filename1 ' ' filename2]); -else - warning('Platform not supported') -end + if ~isequal(ext1,ext2) + %warning('File extension are not identical'); + status = false; + return + end + if ispc + [status,~] = system(['fc ' filename ' ' fileList{i}]); + % 0 -> identical, 1 -> not identical + id(i) = ~status; % false (not identical), true(identical) + + elseif isunix %untested! + [status,~] = system(['diff ' filename ' ' fileList{i}]); + id(i) = ~status; % ??? + else + warning('Platform not supported') + end + +end end diff --git a/fcn_help/createLinkedHDF5.m b/fcn_help/createLinkedHDF5.m index c6c68cba04778b05bdeefac0b5baf9bd0f2a37cb..f2d257491d83d212c94fe3cbc2c204947a4846aa 100644 --- a/fcn_help/createLinkedHDF5.m +++ b/fcn_help/createLinkedHDF5.m @@ -16,5 +16,6 @@ plist_id = 'H5P_DEFAULT'; % warning('No linked HDF file was created'); % status = 0; % end + end diff --git a/test_data.mat b/test_data.mat index f370a2c4bfb09d1835f12174e0af259ae2eddbd0..773ad46e46d0a3ab0dac6b68c057827c4ecaf9de 100644 Binary files a/test_data.mat and b/test_data.mat differ diff --git a/testdata_2.h5 b/testdata_2.h5 index 99ef780a89c863b96e21683ebb76e8e060a806a8..7891e47e55667d2dcbf9db26acca2fd6512ddf8a 100644 Binary files a/testdata_2.h5 and b/testdata_2.h5 differ