SGlibpath

by Robin Schregle & Tim Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CODING/DEVELOP
Introduced first in SolidGeometry 5.5, Creation date: 2025-06-30, Last change: 2025-08-18

returns the filepath of the toolbox directory

Description

uses which and fileparts

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

Example Illustration

 missing image of SGlibpath

Syntax

fpath=SGlibpath

Output Parameter

fpath: filepath without filesep

Examples


SGlibpath % Should work on mac and PC




Copyright 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, SGlibpath, is designed to return the file path of the toolbox directory in which it resides. It is a utility function for file handling, specifically within the SolidGeometry library.

Input Parameters

The function SGlibpath does not take any input parameters. It is called without arguments.

Output

Algorithm Steps

  1. The function uses the which command to determine the full path of a specific file, in this case, 'PLcircle'. The which function is a built-in MATLAB function that returns the full path to the specified file or function.
  2. The result from which is stored in the variable fullpath.
  3. The function then calls fileparts on fullpath. The fileparts function is another built-in MATLAB function that splits a full file path into its constituent parts: the path, the file name, and the file extension.
  4. The fileparts function returns the directory path, which is stored in the variable fpath.
  5. The function returns fpath as the output, which is the directory path of the toolbox without a trailing file separator.

Example Usage

To use the function, simply call SGlibpath in the MATLAB command window. It should work on both Mac and PC platforms:

SGlibpath

Related Functions

The function is related to other file handling functions such as desktopdir, pcodedirTL, smbFilename, smbPSLibname, expname, matlabtoolboxdir, and matlabdir.

Algorithm explaination created using ChatGPT on 2025-08-18 22:33. (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