SGlibmovepathtotop

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CODING/DEVELOP
Introduced first in SolidGeometry 4.7, Creation date: 2019-06-15, Last change: 2025-08-18

moves the SG-Lib directory up in the search path

Description

Matlab adds functions from time to time that have a name that has already been used in the SG-Lib. This leads to conflicts when using the SG-Lib. Tim Lueth fixes these bugs with time but to secure the functionality of the SG-Lib the path of the SG-Lib is set to the top.

Example Illustration

 missing image of SGlibmovepathtotop

Syntax

SGlibmovepathtotop

Examples

Just cann after starting matlab
SGlibmovepathtotop




Copyright 2019-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, SGlibmovepathtotop, is designed to adjust the MATLAB search path to prioritize the SG-Lib directory. This is necessary to avoid conflicts with MATLAB's built-in functions that may have the same names as those in the SG-Lib.

Input Parameters

The function does not take any input parameters. It operates on the current MATLAB environment's search path.

Algorithm Steps

  1. The function begins by using the which command to locate the path of a function named rounddiv. This is stored in the variable sp.
  2. It then checks if the path stored in sp contains the string 'SolidGeometry' using the contains function.
  3. If 'SolidGeometry' is not found in the path, the function proceeds to locate the path of another function named VLFLlicense using which again, updating sp.
  4. The directory path of VLFLlicense is extracted using fileparts and stored in lp.
  5. The function then adds this directory path to the top of the MATLAB search path using addpath.
  6. It saves the updated search path with savepath to ensure the changes persist in future MATLAB sessions.
  7. A warning message is displayed to the user, advising them to save the path to maintain the SG-Lib's priority in the search path.

Output

The function does not return any output. It modifies the MATLAB search path and provides a warning message to the user.

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