From 6384cece349272d91bb01fa44ad64fd92a9b6631 Mon Sep 17 00:00:00 2001
From: "M. Hock" <martin.hock@fst.tu-darmstadt.de>
Date: Fri, 18 Mar 2022 19:12:44 +0100
Subject: [PATCH] Added an error when starting the Initialisation.m on too old
 Matlab Versions Added an example of a config.json for manual config to Readme

---
 Initialisation.m |  8 +++++++-
 README.md        | 42 ++++++++++++++++++++++++++----------------
 2 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/Initialisation.m b/Initialisation.m
index a30816b..7c36c7c 100644
--- a/Initialisation.m
+++ b/Initialisation.m
@@ -6,11 +6,17 @@
 % will help you create one:
 writeConfig = true;
 
+
+% Check for matlab version
+if verLessThan('matlab','9.10')
+    msg="Your matlab Version is lower than 9.10 (2021a). The config file cannot be created with this wizard. You can either input data manually for each export or create the config file manually. For further Information see the Readme. More function might be impaired when using an old Matlab Version.";
+    error(msg);
+end
 % Ask User if current config should be overwritten
 if isfile('config.json')
     m = input('Do you want to overwrite the current config file, Y/N [Y]:','s');
     writeConfig = ismember(m,{'Y','y'});
-end    
+end
 
 if writeConfig
    config = PlotID.config.wizard('initialise');
diff --git a/README.md b/README.md
index 433563d..b1d624a 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Feel free to give feedback and feature requests or to take part in the developme
 **Requirements:** MATLAB R2021a or newer
 
 **First use:**
-1. Put your PlotID folder in you [userpath](https://uk.mathworks.com/help/matlab/ref/userpath.html) on Windows this is 
+1. Put your PlotID folder in you [userpath](https://uk.mathworks.com/help/matlab/ref/userpath.html) on Windows this is
 `C:\Users\USERNAME\Documents\MATLAB`. \
 When using a diffrent folder, make sure the folder is on your [search path](https://uk.mathworks.com/help/matlab/matlab_env/add-remove-or-reorder-folders-on-the-search-path.html).
 
@@ -33,7 +33,7 @@ The **ProjectID** is your custom project number, it well be the prefix of the ID
 `figure` is the figure that should be published.
 
 **Please take also a look on the examples provided in the Example folder**.
- 
+
 
 # PlotID.TagPlot()
 `[figs, IDs] = TagPlot(figs, options)`
@@ -46,15 +46,15 @@ The ID is placed visual on the figure window and as Tag (property of the figure)
 _options_ \
 you find the options for TagPlot below. The data type is in curled braces and the default value follows the equal sign.
 
-- ProjectID  {mustBeText}= '' 
-- Fontsize {mustBeInteger} = 8 
-- Color  {mustBeNonnegative} = 0.65*[1 1 1] 
+- ProjectID  {mustBeText}= ''
+- Fontsize {mustBeInteger} = 8
+- Color  {mustBeNonnegative} = 0.65*[1 1 1]
 - Location  {mustBeText} = 'east'
-- Position  {mustBeVector} = [1,0.4] 
-- DistanceToAxis {mustBeReal} = .02 
-- Rotation  {mustBeInteger} = 0  
-- PinToLegend {mustBeNumericOrLogical} = false 
-- QRcode  {mustBeNumericOrLogical} = false 
+- Position  {mustBeVector} = [1,0.4]
+- DistanceToAxis {mustBeReal} = .02
+- Rotation  {mustBeInteger} = 0
+- PinToLegend {mustBeNumericOrLogical} = false
+- QRcode  {mustBeNumericOrLogical} = false
 - QRsize {mustBeNonnegative} = 0.15
 
 `options.ProjectID` is the project number (string or char), if empty the ID from the config file is used
@@ -69,19 +69,19 @@ The ID is placed on the 'east' of the figure per default, if you want it somwher
 CreateID Creates an identifier (char). It creates an (sometimes unique) identifier based on the selected method, if no method is selected method 1 will be the default method.
 
 1. **UNIX Time in seconds as HEX** \
-This is used by default due to its simplicity and it is human readable. 
+This is used by default due to its simplicity and it is human readable.
 2. **random UUID from Java 128 bit.**\
 Static factory to retrieve a type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator.
 
-## friendlyID() 
+## friendlyID()
 `[IDf,PrjID, Str] = friendlyID(ID)` \
 FriendlyID Changes the Hex Number to a human friendly *datetime* and *dateStr*. `IDf` returns the ID as DateTime Object, `PrjID` returns the ProjectID, `Str` returns the timestamp as String. \
 **This only works with ID method 1.**
 
 
-# PlotID.Publish() 
+# PlotID.Publish()
 `Publish(DataPaths,scriptPath, figure, options)` \
-Publishes saves plot, data and measuring script 
+Publishes saves plot, data and measuring script
 Location sets the storage location. 'local' sets the storage location to the current folder (an export folder will be created), 'manual' opens an explorer window, where you can choose the desired folder. If you define a export path in the config file, this will used per default (exportPath).
 
 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 a path is used, PlotId will use this path a storagePath.
@@ -125,6 +125,16 @@ The config file is a JSON-File. The config file stores user data and options of
 ## Define an export path
 If you define an export path in the config.json this path is used as location for the exported data.
 
+## Example config.json
+
+```
+{
+  "Author": "Name",
+  "ProjectID": "XYZ01",
+  "ExportPath": "C:\\project\\plot_ID"
+}
+```
+
 ## Store custom options for Publish
 **add custom publish options to the config file** \
 you can define your custom options for publish in the config file. **Important:** They will always have priority against Name-Value pairs!
@@ -139,14 +149,14 @@ This method adds the default config to your config file
 configObj.addPublishOptions('default');
 ```
 
-You can change the options in the json file, but be carefull no argumentValidation will be done on options from the config file!
+You can change the options in the json file, but be careful no argumentValidation will be done on options from the config file!
 
 ## Working with multiple (project dependend) config files
 
 <details><summary> Expand </summary>
 It is possible to use individual config files for each project (configP1.json, configP2.json, ...) \
 
-1. Create a new config file programatically 
+1. Create a new config file programatically
 ```
 customConfigFileName = 'configP1.json';
 configObj = PlotID.config(customConfigFileName);
-- 
GitLab