From cd152a092a77d416d815a3b81a8a1a931c56e02f Mon Sep 17 00:00:00 2001 From: Jan Lemmer <jan.lemmer@fst.tu-darmstadt.de> Date: Tue, 27 Jul 2021 11:59:06 +0200 Subject: [PATCH] Work in progress on centralized --- example.m | 4 ++-- fcn_core/CreateID.m | 2 -- fcn_core/Publish.m | 9 +++++--- fcn_help/FileCompare.m | 42 ++++++++++++++++++++++-------------- fcn_help/createLinkedHDF5.m | 1 + test_data.mat | Bin 1523 -> 1535 bytes testdata_2.h5 | Bin 3064 -> 3064 bytes 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/example.m b/example.m index b160cbf..45c7e39 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 7291727..42ec2b2 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 5e941ce..c970e7d 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 a4f735b..325cfe5 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 c6c68cb..f2d2574 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 GIT binary patch delta 891 zcmey&{hxb+J+Gmmm8pf5iIIYlfsx_F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$ThE(>{AA0EupGwb)4$((xiI%{6Oc=BLpdg1z) zo4$xUW_ns{aTq;)xl5d@N#1MO(T#mdTK@d*ccl|2?EJYz=R#k?i@b>amaYy*Ma%n( z!r49@EV;U2YscM>?eT41zt0`hDy$LiR(-f%%So<aMZH;>_P!2h??qa<ucPG5j+#}K z>&uyD?hM!`b<+RuX_LQ7FXhzY&+pkD;t=-firsm0o-2a;i;e$QR9t^&CV87>&ir3$ s+ulhXY+EMns(W?P`(o>8Q;u2h@0_d(RavlZU+MB?5eLL2?gV%M0Lzz~MgRZ+ diff --git a/testdata_2.h5 b/testdata_2.h5 index 99ef780a89c863b96e21683ebb76e8e060a806a8..7891e47e55667d2dcbf9db26acca2fd6512ddf8a 100644 GIT binary patch delta 27 jcmew%{zH7j9%iOXH#YBM4r64xbYt>9=Az9VtOaZUxXlbL delta 27 jcmew%{zH7j9%iN$J2vlQ4r63mv19T+=Az9VtOaZUuwe_C -- GitLab