SGtitle

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.6, Creation date: 2017-03-19, Last change: 2025-09-14

draws the name of the calling fnct as figure title

Description

same as title(titleofcaller,'Interpreter','none');
Since 2018b there is a conflict with a new function sgtitle

See Also: titleofcaller , sgtitle , VLFLfigure , SGfigure , select3d , pixelofaxis , VLFLplotlight

Example Illustration

 missing image of SGtitle(n,w)

Syntax

SGtitle([n,w])

Input Parameter

n: hierarchy of calling functions; default is 0;
w: 'window' renames the window instead of a gca title

Examples


SGfigure; SGtitle
SGfigure; SGtitle(1)
SGfigure; SGtitle(-1)




Copyright 2017-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, SGtitle, is designed to set the title of a figure or window in MATLAB. It is part of the SolidGeometry library and was created to address a conflict with MATLAB's built-in sgtitle function introduced in version 2018b.

Input Parameters

Algorithm Steps

  1. Initialize n to 0 and w to an empty string. These are default values.
  2. Check if there are input arguments. If the first argument is provided and not empty, set n to this value. If the second argument is provided and not empty, set w to this value.
  3. If there is more than one axes object in the current figure, set w to 'fig'. This ensures that the title is applied to the figure rather than individual subplots.
  4. Retrieve the title string using the titleofcaller function, which uses the hierarchy level n to determine the appropriate function name from the call stack.
  5. Use a switch statement to determine how to apply the title based on the value of w:
Algorithm explaination created using ChatGPT on 2025-08-19 01:38. (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