diff --git a/lib/storage/@LevelData/LevelData.m b/lib/storage/@LevelData/LevelData.m
index dcfae083c35c84f2758ea5c98079b01f2fdb2c0f..8c0baa8d3bc677b973dc0d04f54538e58da7b232 100644
--- a/lib/storage/@LevelData/LevelData.m
+++ b/lib/storage/@LevelData/LevelData.m
@@ -277,29 +277,29 @@ classdef LevelData < handle
 
         function spec = getHeaderSpecifier(obj, separator)
             % Creates formatting string for the header of the output to command line
-            spec = '';
+            spec = cell(1, obj.nScalarVariable);
             for j = 1:obj.nScalarVariable
-                if j == obj.nScalarVariable
-                    separator = '\n';
-                end
                 t = obj.type.(obj.scalarVariable{j});
-                spec = [spec, '%', obj.getWidth(t), 's', separator];
+                spec{j} = assembleSpecifier(obj.getWidth(t), 's');
             end
+            spec = strjoin(spec, separator) + "\n";
         end
 
         function spec = getFormatSpecifier(obj, separator)
             % Creates formatting string for printing to command line
-            spec = '';
+            spec = cell(1, obj.nScalarVariable);
             for j = 1:obj.nScalarVariable
-                if j == obj.nScalarVariable
-                    separator = '\n';
-                end
                 t = obj.type.(obj.scalarVariable{j});
-                spec = [spec, '%', obj.getWidth(t), t.formatSpec, separator];
+                spec{j} = assembleSpecifier(obj.getWidth(t), t.formatSpec);
             end
+            spec = strjoin(spec, separator) + "\n";
         end
 
         ax = plotLevel(obj, plotFunction, xVariable, variableName)
         plotLevelTriangulation(obj, ax, jLevel)
     end
 end
+
+function spec = assembleSpecifier(width, format)
+    spec = ['%', num2str(width), format];
+end
\ No newline at end of file
diff --git a/lib/storage/@LevelData/saveToFile.m b/lib/storage/@LevelData/saveToFile.m
index b46a2b80a0abbadc9ea1d4323d629d351cdfd0e3..19125149b34e76360d69218817de8c03e3b45e3c 100644
--- a/lib/storage/@LevelData/saveToFile.m
+++ b/lib/storage/@LevelData/saveToFile.m
@@ -21,14 +21,12 @@ function saveToFile(obj, folder, file)
 % along with this program.  If not, see <http://www.gnu.org/licenses/>.
 %
 
-
-    % Proceed optional input
-    if nargin < 2
-        folder = obj.foldername;
-    end
-    if nargin < 3
-        file = obj.filename;
+    arguments
+        obj
+        folder {mustBeTextScalar} = obj.foldername
+        file {mustBeTextScalar} = obj.filename
     end
+
     % Create problem- and method-specific folder
     ensureFolderExists(folder);
     % Save this object to file