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

Move CopyUserFCn in an external FCN

Move removePltIdFile as local function in CopyUserFCn
parent b9c1388d
No related branches found
No related tags found
2 merge requests!62Introduce changes for V1.0 RC 1,!55Implements #96
......@@ -161,13 +161,7 @@ dlgObj.userMSG(msg);
% user functions
if options.CopyUserFCN
[fList,pList] = matlab.codetools.requiredFilesAndProducts(scriptPath);
fList = fList(~ismember(fList,scriptPath)); % rmv script from list
fList = fList(~contains(fList,'config.json')); % rmv config.json from list
fList = PlotID.removePltIdFiles(fList); % Do not copy files that are part of PlotID
if ~isempty(fList)
PlotID.createFileCopy(fList,folderName,storPath,ID,'userFcn');
end
toolboxList = PlotID.copyUserFCN(scriptPath, folderName, storPath, ID);
end
%% Research data handling
......@@ -239,7 +233,7 @@ meta.ProjectID = ID;
meta.CreationDate = datestr(now);
meta.MatlabVersion = version;
if options.CopyUserFCN
meta.ToolboxVersions = pList;
meta.ToolboxVersions = toolboxList;
end
% write meta
metaPath = fullfile(storPath,folderName,'plotID_data.json');
......
function pList = copyUserFCN(scriptPath, folderName, storPath, ID)
[fList,pList] = matlab.codetools.requiredFilesAndProducts(scriptPath);
fList = fList(~ismember(fList,scriptPath)); % rmv plot script itself from list
fList = fList(~contains(fList,'config.json')); % rmv config.json from list
fList = PlotID.removePltIdFiles(fList); % Do not copy files that are part of PlotID
if ~isempty(fList)
PlotID.createFileCopy(fList,folderName,storPath,ID,'userFcn');
end
end
function [fListClean] = removePltIdFiles(fList)
%removePltIdFiles removes functions that are part of PlotID out of flist
% Detailed explanation goes here
[~,names,ext] = fileparts(fList);
names = strcat(names, ext); % add ext for comparison
% Get a list of all .m files that are part of Plot id
packageContent = what('PlotID');
% packageContent.classes has no extensions
PltID_classlist = packageContent.classes;
% Class Methods need to be listed in an additional function
Class_flist = cell(1,numel(packageContent.classes)); %preallocate
for i=1:numel(packageContent.classes)
temp = what(['PlotID',filesep,'@',PltID_classlist{i}]);
Class_flist{i} = temp.m;
end
Class_flist = vertcat(Class_flist{:});
% all plotID .m files:
PltID_flist = [packageContent.m; Class_flist];
% Comparison and filter
fListClean = fList(~ismember(names,PltID_flist));
end
\ No newline at end of file
function [fListClean] = removePltIdFiles(fList)
%removePltIdFiles removes functions that are part of PlotID out of flist
% Detailed explanation goes here
[~,names,ext] = fileparts(fList);
names = strcat(names, ext); % add ext for comparison
% Get a list of all .m files that are part of Plot id
packageContent = what('PlotID');
% packageContent.classes has no extensions
PltID_classlist = packageContent.classes;
% Class Methods need to be listed in an additional function
Class_flist = cell(1,numel(packageContent.classes)); %preallocate
for i=1:numel(packageContent.classes)
temp = what(['PlotID',filesep,'@',PltID_classlist{i}]);
Class_flist{i} = temp.m;
end
Class_flist = vertcat(Class_flist{:});
% all plotID .m files:
PltID_flist = [packageContent.m; Class_flist];
% Comparison and filter
fListClean = fList(~ismember(names,PltID_flist));
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment