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

Merge branch 'development'

# Conflicts:
#	+PlotID/createLinkedHDF5.m
parents de27fd53 d2a9d919
No related branches found
No related tags found
1 merge request!50Draft: FIX bug that causes Error when COPYUSER FCN is off and a broken
Pipeline #638395 passed
......@@ -10,13 +10,13 @@ function Publish(DataPaths,scriptPath, figure, options)
% Location sets the storage location. 'local' sets the storage location
% to the current folder (an export folder will be created), 'manual' opens
% a explorer window, where you can choose the folder. If you define a export
% path in the config file, this will used per default.
% path in the config file, this will used per defaul (exportPath).
% remote path, that is defined in the config file.
% Two Methods are implemented 'individual' stores the data for
% each plot while 'centralized' uses a data folder and uses reference links
% to the original data (hdf5 only).
% 'ParentFolder' is the folder Name where the exported data is stored if an
% path is used, PlotId will use this path a storagePath
% path is used, PlotId will use this path as storagePath
% 'ConfigFileName' is needed for handling multiple config files (see example)
% 'CSV' turns a summary table of all exports on or off
%
......@@ -27,9 +27,9 @@ function Publish(DataPaths,scriptPath, figure, options)
arguments
DataPaths {mustBeDataPath} % location of the data-file(s)
scriptPath (1,:) {mustBeFile} % location of the matlab script
scriptPath (1,:) {mustBeText} % location of the matlab script
figure (1,:) {mustBeFigure} % Checks if figure is a figure object
options.Location {mustBeMember(options.Location ,{'local','server','manual','CI-Test'})} = 'local' % storage path
options.Location {mustBeMember(options.Location ,{'local','exportPath','manual','CI-Test'})} = 'local' % storage path
options.Method {mustBeMember(options.Method ,{'individual','centralized'})} = 'individual'
options.ParentFolder (1,:) {mustBeText} = 'PlotID_export' % name of the ParentFolder
options.ConfigFileName (1,:) {mustBeText} = 'config.json' %individual config names possible
......@@ -66,6 +66,16 @@ if numel(figure) > 1
warning(msg);
end
% find scriptpath
if ~isfile(scriptPath)
scriptPath= which(['/',scriptPath]);
if ~isfile(scriptPath)
msg = ['Script path: ',scriptPath, ' not found on matlab path', newline, ...
'- check spelling or us a path'];
error(msg);
end
end
% catch missing .m extension
[~,~, scriptExt] = fileparts(scriptPath);
if isempty(scriptExt)
......@@ -118,13 +128,6 @@ switch options.Location
'does not exist, check the config file - publishing not possible!'];
dlgObj.error(msg);
end
case 'server' %legacy
if dlgObj.configError
msg = ['Error while reading the config file' newline,...
' publishing on server not possible'];
dlgObj.error(msg);
end
storPath = configObj.configData.ServerPath;
case 'manual' %UI
storPath = uigetdir();
case 'CI-Test' %only for CI tests
......@@ -165,8 +168,8 @@ dlgObj.scriptPublished =status;
dlgObj.userMSG(msg);
% user functions
[fList,pList] = matlab.codetools.requiredFilesAndProducts(scriptPath);
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
......@@ -243,8 +246,9 @@ end
meta.ProjectID = ID;
meta.CreationDate = datestr(now);
meta.MatlabVersion = version;
if options.CopyUserFCN
meta.ToolboxVersions = pList;
end
% write meta
metaPath = fullfile(storPath,folderName,'plotID_data.json');
fid = fopen(char(metaPath),'w');
......
......@@ -13,9 +13,6 @@ end
[~,filename,ext] = fileparts(SourceFile);
try
%old
%fid = H5F.create(fullfile(TargetPath,ID,[ID,'_data.h5']));
fid = H5F.create(fullfile(TargetPath,[filename,ext]));
%create External Link to Sourcefile in the Group linkToExternal
H5L.create_external(['..',SourceFile],'/',fid, SourceFile ,plist_id,plist_id);
......
......@@ -27,16 +27,18 @@ codegen/
# Simulink autosave extension
*.autosave
# Data files (all .mat and .h5 files)
*.mat
*.h5
# Personal test files
test*.m
test*.h5
cleanUP.m
#test folder
test_*/*
# files that are created in example.m
testdata_2.h5
testdata2.h5
test_data.mat
export/*
PlotID_export/*
Examples/export/*
......
# V0.3
- Add changelog
- Add support for file or function name as scriptPath
- Fix a Bug in HDF linking
# runtest.ps1
$LOGFILE='CI_log.txt'
$wd = pwd;
$LOGFILE = $("$wd" + "\" + "$LOGFILE")
$CIfolder = "$wd" + "\" + "CI_files\"
# $MFILE='"C:\git\NFDI4ing\plot_ID_matlab\CI_files\runner_test.m"'
$arguments = "-nodesktop", "-nosplash","-minimize","-wait","-sd", "$wd", "-logfile", "$LOGFILE","-batch","CI_files\test_runner_STFS.m"
$Returnvalue = & 'C:\Program Files\MATLAB\R2021b\bin\matlab.exe' $arguments
#$CODE = $?
# Returnvalue doesnt get anything useful from matlab
# Write-Output($Returnvalue)
Write-Output(Get-Content($LOGFILE))
exit $CODE
......@@ -28,8 +28,8 @@ The **ProjectID** is your custom project number, it well be the prefix of the ID
2. Publish the plot and the associated data
`PlotID.Publish(DataPaths,scriptPath, figure, options)`
`scriptPath` contains the path to the script, this can be provided with the simple call of `scriptPath = [mfilename('fullpath'),'.m']` \
`DataPaths` contains the path(s) to the research data, for multiple files you can use a cell arrays (they must be at the path). \
`scriptPath` contains either the path to the script, this can be provided with the simple call of `scriptPath = [mfilename('fullpath'),'.m']` or the script or function name that is used for creating your plot. \
`DataPaths` contains the path(s) to the research data, for multiple files you can use a cell array (they must be at the path). \
`figure` is the figure that should be published.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment