From a0d9a15793d7af3302b7acb9416a21915f67436b Mon Sep 17 00:00:00 2001 From: Jan Lemmer <jan.lemmer@fst.tu-darmstadt.de> Date: Thu, 24 Feb 2022 11:14:20 +0100 Subject: [PATCH] Improve all help comments --- +PlotID/@config/config.m | 4 ++-- +PlotID/@dataPath/dataPath.m | 2 +- +PlotID/@userDLG/userDLG.m | 14 +++++++------- +PlotID/CreateID.m | 2 +- +PlotID/Publish.m | 2 +- +PlotID/TagPlot.m | 2 +- +PlotID/centralized.m | 8 ++++++-- +PlotID/copyUserFCN.m | 10 +++++++--- +PlotID/createFileCopy.m | 9 ++++++--- +PlotID/createLinkedHDF5.m | 4 ++-- +PlotID/fileCompare.m | 9 +++++---- +PlotID/friendlyID.m | 7 ++++--- +PlotID/plotQR.m | 13 ++++++++----- +PlotID/replaceLinkedHDF5.m | 2 -- 14 files changed, 51 insertions(+), 37 deletions(-) diff --git a/+PlotID/@config/config.m b/+PlotID/@config/config.m index cfece4d..b9b4779 100644 --- a/+PlotID/@config/config.m +++ b/+PlotID/@config/config.m @@ -1,7 +1,7 @@ classdef config < handle - %CONFIG class handles methods and attributes related to the config + % CONFIG class handles methods and attributes related to the config %file - %handle class used for dynamicy property updates + % handle class used for dynamicy property updates properties (SetAccess = private) mandatoryFields = {'Author', 'ProjectID'} diff --git a/+PlotID/@dataPath/dataPath.m b/+PlotID/@dataPath/dataPath.m index bc4f395..2edf934 100644 --- a/+PlotID/@dataPath/dataPath.m +++ b/+PlotID/@dataPath/dataPath.m @@ -1,5 +1,5 @@ classdef dataPath < handle - %DATAPATH stores the datapaths to the research data + % DATAPATH stores the datapaths to the research data % usage of a class is neccessary to support variables, argument % validation and storing variables as tempory files diff --git a/+PlotID/@userDLG/userDLG.m b/+PlotID/@userDLG/userDLG.m index 7b82f79..579d111 100644 --- a/+PlotID/@userDLG/userDLG.m +++ b/+PlotID/@userDLG/userDLG.m @@ -1,19 +1,19 @@ classdef userDLG - %userDLG the userDLG Class is responsible for the user dialog + % userDLG the userDLG Class is responsible for the user dialog % error handeling, user messages and warnings will be provided from % this class, depending on the user options and error type. % This reduces messaging overhead and code length in PlotID.Publish() properties - configError = false - scriptPublished = false - rdFilesPublished = false - figurePublished = false - msg = '' + configError = false % error state of reading the config + scriptPublished = false % error state of publishing the script + rdFilesPublished = false % error state of publishing the research data + figurePublished = false % error state of publishing the figure + msg = '' % message to the user end properties (SetAccess = protected) - success = false + success = false % product of all states showMessages {mustBeNumericOrLogical} forcePublish {mustBeNumericOrLogical} ID %plotID diff --git a/+PlotID/CreateID.m b/+PlotID/CreateID.m index 2579717..9ae087d 100644 --- a/+PlotID/CreateID.m +++ b/+PlotID/CreateID.m @@ -1,5 +1,5 @@ function [ID] = CreateID(method) -%CreateID Creates an identifier (char) +% CreateID Creates an identifier (char) % Creates an (sometimes unique) identifier based on the selected method % if no method is selected method 1 will be the default method arguments diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index ddb9017..909dc03 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -1,5 +1,5 @@ function Publish(DataPaths,scriptPath, figure, options) -%%Publish(DataPaths,scriptPath, ID, figure, options) saves plot, data and measuring script +% Publish(DataPaths,scriptPath, ID, figure, options) saves plot, data and measuring script % % DataPaths contains the path(s) to the research data, for multiple files % use a cell array or ONE struct of variables (only the first struct will diff --git a/+PlotID/TagPlot.m b/+PlotID/TagPlot.m index 896e26e..d36e691 100644 --- a/+PlotID/TagPlot.m +++ b/+PlotID/TagPlot.m @@ -1,5 +1,5 @@ function [figs, IDs] = TagPlot(figs, options) -%TagPlot adds IDs to figures +% 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. % If a single Plot is tagged IDs is a char, otherwise it is a cell array of diff --git a/+PlotID/centralized.m b/+PlotID/centralized.m index f5c92e7..ff9b45b 100644 --- a/+PlotID/centralized.m +++ b/+PlotID/centralized.m @@ -1,6 +1,10 @@ function [status, msg] = centralized(storPath, dataObj, folderName) -%centralized stores the research files in a centrelized folder. Linked -%files are created for subsequent folders (HDF5 only). +% CENTRALIZED stores the research files in a centrelized folder. +% Linked files are created for subsequent folders (HDF5 only). +% +% storPath for the Data +% dataObj contains tha data related information +% folderName is the Name of the storage Folder msg = ''; warning(['Linked HDF5 can only be moved with their ',... 'respective master files in the ', dataObj.dataFolderName, ' folder.']); diff --git a/+PlotID/copyUserFCN.m b/+PlotID/copyUserFCN.m index 4525737..cabf490 100644 --- a/+PlotID/copyUserFCN.m +++ b/+PlotID/copyUserFCN.m @@ -1,7 +1,11 @@ function pList = copyUserFCN(scriptPath, folderName, storPath, ID) -%COPYUSERFCN copies all user functions, classes and toolboxes that are used -%by the base script (scriptpath). -% folderName, storPath and ID are required for createfilecopy +% COPYUSERFCN copies all user functions, classes and toolboxes that are used +% by a script (scriptpath). +% +% All toolboxes and classes are copied as a whole. +% folderName, storPath and ID are required for createfilecopy +% see also createFileCopy + [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 diff --git a/+PlotID/createFileCopy.m b/+PlotID/createFileCopy.m index f27ea2e..297203c 100644 --- a/+PlotID/createFileCopy.m +++ b/+PlotID/createFileCopy.m @@ -1,7 +1,10 @@ function [storagePaths, status, msg] = createFileCopy(filePaths,folderName,storPath,ID,type) -% Creates a copy of the files (can be used for multiple paths in a cell array) -% folderName is the name of the exporting folder -% returns the storage paths were files were stored +% createFileCopy Creates a copy of the files (can be used for multiple +% paths in a cell array) +% +% folderName is the name of the exporting folder +% returns the storage paths were files were stored +% type switches the mode depending on the data type if ~iscell(filePaths) %fixes Issue if filepath is a char and not a cell array diff --git a/+PlotID/createLinkedHDF5.m b/+PlotID/createLinkedHDF5.m index 70e6ec3..46dacbd 100644 --- a/+PlotID/createLinkedHDF5.m +++ b/+PlotID/createLinkedHDF5.m @@ -1,6 +1,6 @@ function [status] = createLinkedHDF5(SourceFile,TargetPath) -%createLinkedHDF5 creates a HDF file that references the Sourcefile -% TargetPath is the storage location, ID the foldername +% createLinkedHDF5 creates a HDF file that references the Sourcefile +% TargetPath is the storage location % Status returns true if the function was successfull plist_id = 'H5P_DEFAULT'; diff --git a/+PlotID/fileCompare.m b/+PlotID/fileCompare.m index 9d0f969..43ca371 100644 --- a/+PlotID/fileCompare.m +++ b/+PlotID/fileCompare.m @@ -1,9 +1,10 @@ function [status, id] = fileCompare(filename,fileList) -%% fileCompare checks if file1 is (binary) identical to a file in filelist +% fileCompare checks if file1 is (binary) identical to a file in filelist % it returns a status and the id of the identical file -% the functions uses the java libraries from matlab for windows systems -% or the unix function diff -% because of performance issues with windows system calls in matlab +% +% the functions uses the java libraries from matlab for windows systems +% or the unix function diff because of performance issues with windows +% system calls in matlab if isempty(fileList) % no comparison necessary diff --git a/+PlotID/friendlyID.m b/+PlotID/friendlyID.m index cdac106..1a26af2 100644 --- a/+PlotID/friendlyID.m +++ b/+PlotID/friendlyID.m @@ -1,7 +1,8 @@ function [IDf,PrjID, Str] = friendlyID(ID) -%FriendlyID Changes the Hex Number to a human friendly datetime and dateStr -% IDf ID as DateTime Object, PrjID returns the ProjectID, Str returns the -% timestamp as String +% FriendlyID Changes the Hex Number to a human friendly datetime and dateStr +% +% IDf ID as DateTime Object, PrjID returns the ProjectID, Str returns the +% timestamp as String %Remove Prefix if contains(ID,'-') diff --git a/+PlotID/plotQR.m b/+PlotID/plotQR.m index 4e44b97..6cdccc7 100644 --- a/+PlotID/plotQR.m +++ b/+PlotID/plotQR.m @@ -1,8 +1,11 @@ -function img = plotQR(data, size) -%QR reads a QR code from qrserver (depends on API) -% created by J.Stifter +function img = plotQR(qrTxt, size) +% plotQR creates a QR code based on qrTxt by calling a qrserver (depends on +% API) +% size specifies the absolut size of the qr code (pixels) +% special thanks to J.Stifter for this suggestion + arguments - data {mustBeTextScalar} = 'example'; + qrTxt {mustBeTextScalar} = 'example'; size (1,2) {mustBeInteger} = [150, 150]; end @@ -10,7 +13,7 @@ function img = plotQR(data, size) n = size(2); base_api = 'https://api.qrserver.com/v1/create-qr-code/?size=%dx%d&data=%s'; - request = sprintf(base_api, m, n, data); + request = sprintf(base_api, m, n, qrTxt); options = weboptions; options.Timeout = 5; diff --git a/+PlotID/replaceLinkedHDF5.m b/+PlotID/replaceLinkedHDF5.m index e84e49f..07f3435 100644 --- a/+PlotID/replaceLinkedHDF5.m +++ b/+PlotID/replaceLinkedHDF5.m @@ -6,8 +6,6 @@ function replaceLinkedHDF5(linkedFilepath) % Filepath is the location of the File that contains the link. The % filepath to the linked data has to be present in the file itself. - - %% Check whether the only Objects present are links h5inf = h5info(linkedFilepath); -- GitLab