matlabdir

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

returns the default matlab directory that is also used for custom toolboxes

Description

On mac: '/Users/lueth/Documents/MATLAB/'


See Also: desktopdir , pcodedirTL , smbFilename , smbPSLibname , workdir , matlabtoolboxdir

Example Illustration

 missing image of matlabdir

Syntax

mldir=matlabdir

Output Parameter

mldir: default user matlab directory

Examples


matlabdir, dir (matlabdir)




Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

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.

Input Parameters

The function does not take any input parameters.

Output

Algorithm Explanation

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:

  1. It calls the desktopdir function to obtain the current desktop directory path and stores it in the variable dd.
  2. It uses the 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.
  3. The function constructs the MATLAB directory path by concatenating the substring of 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.

Assumptions

Algorithm explaination created using ChatGPT on 2025-08-18 22:53. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21