by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - File handling
Introduced first in SolidGeometry 4.3, Creation date: 2018-09-23, Last change: 2025-08-18
mldir=matlabdir
mldir: | default user matlab directory |
matlabdir, dir (matlabdir)
This function, named matlabdir, is designed to return the default MATLAB directory used for custom toolboxes. It is part of the SolidGeometry library and was introduced in version 4.3. The function is specifically tailored for macOS systems.
The function does not take any input parameters.
mldir: This is the output of the function, representing the default user MATLAB directory path.The function begins by checking if the operating system is macOS using the ismac function. If the system is macOS, it proceeds with the following steps:
desktopdir function to obtain the current desktop directory path and stores it in the variable dd.strfind function to locate all occurrences of the file separator character (denoted by filesep) within the dd string. The indices of these occurrences are stored in the variable k.dd up to the second-to-last file separator (using k(end-1)), followed by the string 'Documents/MATLAB/'. This constructed path is assigned to the output variable mldir.desktopdir function is assumed to return the correct desktop directory path.