Skip to content
Snippets Groups Projects

Resolve "bug: "Filename already exists in data folder" although the comparison chose "no identical file""

17 files
+ 776
101
Compare changes
  • Side-by-side
  • Inline

Files

 
function [result] = default_test()
 
%UNTITLED2 This is a simple test if Plot ID works for the default settings
 
% Detailed explanation goes here
 
 
clear; clc; close all;
 
addpath('./fcn_core','./fcn_help');
 
 
ProjectID = 'Test01';
 
%% Data
 
% some random data
 
x = linspace(0,7);
 
y = rand(1,100)+2;
 
dataset1 = 'test_data.mat';
 
save('CI_files/test_data.mat','x','y');
 
% some data as .h5
 
x1 = linspace(0,2*pi);
 
y1 = sin(x1)+2;
 
 
% define file path & name
 
fpath = "CI_files/testdata_2.h5";
 
dataset2 = 'testdata_2.h5';
 
 
% create hdf5 file and dataset > write data to hdf5 file / dataset
 
h5create(fpath, "/x1", size(x1), "Datatype", class(x1))
 
h5create(fpath, "/y1", size(y1), "Datatype", class(y1))
 
h5write(fpath, "/x1", x1)
 
h5write(fpath, "/y1", y1)
 
 
%% Plotting
 
 
fig(1) =figure('visible','off');
 
plot(x,y,'-k');
 
hold on
 
plot(x1,y1,'-r');
 
 
%% Tag the plot
 
try
 
[figs, ID] = TagPlot(fig, ProjectID);
 
 
%% call a dummy function
 
a=1;
 
a = example_fcn(a);
 
 
%% publishing
 
 
% The functions needs the file location, the location of the data and the
 
% figure
 
path.script = mfilename('fullpath'); % filename of the m.script
 
 
% file name of the data
 
path.rdata = {dataset1,dataset2} ; % don't forget the extension
 
 
Publish(path, ID, figs, 'Location', 'CI-Test')
 
 
% clean up
 
delete CI_files/export/* CI_files/*.mat CI_files/*.h5
 
rmdir('CI_files/export','s');
 
result = true;
 
clc;
 
catch
 
result = false;
 
warning('simple_test failed');
 
end
 
 
end
 
Loading