Skip to content
Snippets Groups Projects
Commit 4edd7e41 authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Implements #13

Removes unecessary files
parent 283b1a1d
Branches
Tags
3 merge requests!13PreRelease_V0.1,!12PreRelease_V0.1,!1Add Link-replacement feature
......@@ -35,3 +35,4 @@ export/*
# Octave session info
octave-workspace
test_data.mat
......@@ -58,7 +58,7 @@ 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', 'local','Method','individual')
Publish(path, ID, figs, 'Location', 'local','Method','centraliced')
%% Second Plot with identical data to test centralized method
%
......
......@@ -95,43 +95,6 @@ disp(['publishing of ', ID , ' done']);
end %function
function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% Creates a copy of the files (can used for multiple paths in a cell array)
% folderName is the name of the exporting folder
disp(['start to copy ', type]);
% try
for i = 1:numel(filePaths)
FileNameAndLocation = filePaths{i};
[~,name,ext] = fileparts(filePaths{i}); % get the extension
switch type
case 'data'
sufix = '_data';
newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]);
case 'dataCentral'
%keep original name
newfile = sprintf([name,ext]);
case 'script'
sufix = '_script';
newfile = sprintf([ID, sufix ,ext]);
case 'userFcn'
%keep original name
newfile = sprintf([name,ext]);
otherwise
error([type,' is not a valid type for createFileCopy'])
end %switch
% Write the file
RemotePath = fullfile(storPath,folderName, newfile);
copyfile(FileNameAndLocation,RemotePath);
end
disp([type, ' sucessfully published']);
% catch
% warning([type,' export was not sucessful'])
% end %try
end
function tf = mustBeFigure(h)
%checks if input is a figure object
tf = strcmp(get(h, 'type'), 'figure') & isa(h, 'matlab.ui.Figure');
......
function [figs, ID] = TagPlot(figs, prefix)
function [figs, ID] = TagPlot(figs, prefix, options)
%TagPlot adds IDs to figures
% The ID is placed visual on the figure window and as Tag (Property of figure)
% TagPlot can tag multiple figures at once
% prefix is the project number (string or char)
%
% The ID is placed on the 'east' per default, if you want it somwhere
% else, use the 'Location' option. 'north','east','south','west' are
% predefined, otherwise use the 'custom' option and provide the desired
% 'Position' (relative to your x- and y-axis limits)
arguments
figs (1,:) {mustBeFigure}
prefix (1,:) {mustBeText}= ''
options.Fontsize (1,1) {mustBeInteger} = 8
options.Location (1,:) {mustBeText} = 'east'
options.Position (1,2) {mustBeVector} = [1,0.4] % default for east
options.Rotation (1,1) {mustBeInteger} = 0
end
if isempty(prefix)
warning('no project prefix defined')
end
switch options.Location
case 'north'
options.Position = [0.4,0.95];
options.Rotation = 0;
case 'east'
options.Position = [1,0.4];
options.Rotation = 90;
case 'south'
options.Position = [0.4,.02];
options.Rotation = 0;
case 'west'
options.Position = [.05,0.4];
options.Rotation = 90;
case 'custom'
% Check if Position is valid
if ~all(0 <= options.Position & options.Position <= 1)
options.Position = [1,0.4];
warning('options.Position is not valid, TagPlot default values instead');
end
otherwise % set default position
warning([options.Location, ' is not a defined location, TagPlot uses location east instead']);
options.Location = 'east'; options.Position = [1,0.4];
end
for n = 1:numel(figs)
ID = CreateID; % Create ID
ID = [prefix,'-',ID]; % add Prefix
......@@ -19,8 +53,10 @@ for n = 1:numel(figs)
ylim =get(axes,'YLim');
xlim =get(axes,'XLim');
%ID
text(axes,xlim(2),0.4*ylim(2), ID,'Fontsize',8,'Rotation',90,'VerticalAlignment','bottom',...
'Color', 0.65*[1 1 1],'BackgroundColor','w');
position = [options.Position(1)*xlim(2), options.Position(2)*ylim(2)];
text(axes,position(1),position(2), ID,'Fontsize',options.Fontsize,...
'Rotation',options.Rotation, 'VerticalAlignment','bottom','Color',...
0.65*[1 1 1],'BackgroundColor','w');
set(figs(n),'Tag', ID);
end
......
function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% Creates a copy of the files (can used for multiple paths in a cell array)
% folderName is the name of the exporting folder
disp(['start to copy ', type]);
% try
for i = 1:numel(filePaths)
FileNameAndLocation = filePaths{i};
[~,name,ext] = fileparts(filePaths{i}); % get the extension
switch type
case 'data'
sufix = '_data';
newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]);
case 'dataCentral'
%keep original name
newfile = sprintf([name,ext]);
case 'script'
sufix = '_script';
newfile = sprintf([ID, sufix ,ext]);
case 'userFcn'
%keep original name
newfile = sprintf([name,ext]);
otherwise
error([type,' is not a valid type for createFileCopy'])
end %switch
% Write the file
RemotePath = fullfile(storPath,folderName, newfile);
% Check if remote file already exists (not working)
% count = 0;
% while isfile(RemotePath) && ismember(type,{'data','dataCentral'})
% % Add a Sufix number to file name
% count = count + 1;
% [~,name,ext] = fileparts(RemotePath);
% RemotePath = fullfile(storPath,folderName,...
% [name,'_',num2str(count),ext]);
% end
copyfile(FileNameAndLocation,RemotePath);
end
disp([type, ' sucessfully published']);
% catch
% warning([type,' export was not sucessful'])
% end %try
end
File deleted
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment