lastuidir

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CODING/DEVELOP
Introduced first in SolidGeometry 5.0, Creation date: 2021-01-31, Last change: 2025-09-01

returns the file parts of the last uiopend file

Description

lastuidir addresses the last opend file in the editor bu uiopen (drag and drop into the command window)

See Also: lasttouchedSG , imreadlastchanged

Example Illustration

 missing image of lastuidir

Syntax

[fp,fn,fe]=lastuidir

Output Parameter

fp: file path plus filesep
fn: file name
fe: file extension




Copyright 2021-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, lastuidir, is designed to retrieve the file path, file name, and file extension of the last file opened in the MATLAB editor using the uiopen function. It is part of the SolidGeometry library and was introduced in version 5.0.

Input Parameters

The function does not take any input parameters. It operates based on the internal state of the MATLAB environment, specifically the history of files opened using uiopen.

Output Parameters

Algorithm Steps

  1. The function calls HxSearch with the string 'uiopen(' to search for occurrences of files opened using uiopen. The search is limited to the most recent occurrence by specifying the last parameter as 1.
  2. If multiple results are found, the function selects the last entry using text(end,:).
  3. The function locates the position in the string where the file path starts by searching for 'uiopen('' and adjusts the index accordingly.
  4. It then extracts the substring containing the file path and name by finding the position of the closing '' before ',1)'.
  5. The fileparts function is used to split the extracted string into the file path, name, and extension.
  6. The file path is concatenated with the file separator to ensure it ends with a separator.
Algorithm explaination created using ChatGPT on 2025-08-18 23:01. (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