Syntax
dbmode=dbprintmode([md])
Input Parameter
md : | | true or false; default is true; |
Output Parameter
Examples
% can be tested only within functns
dbprintf
dbprintmode on
dbprintf
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, dbprintmode
, is designed to toggle a debugging mode in MATLAB, specifically for the SolidGeometry library. It allows users to quickly enable or disable the ability to reach code lines using the dbprintf
function.
Input Parameters
- md: A boolean value or string ('on'/'off'). It determines whether the debugging mode is enabled or disabled. The default value is 'on'.
Output Results
- dbmode: A boolean value indicating the current state of the debugging mode (true for 'on', false for 'off').
Algorithm Steps
- The function begins by retrieving the input parameter
md
using the getfuncparams
function. If no input is provided, it defaults to 'on'.
- If
md
is a string and equals 'off', it is converted to false
. If it equals 'on', it is converted to true
.
- A global variable
SGdbprintmode
is used to store the state of the debugging mode.
- If
md
is false
:
- Set
SGdbprintmode
to false
.
- If no output is expected, print a message indicating that the debugging mode is "off".
- Disable backtrace warnings using
warning('Off','BACKTRACE')
.
- Set
dbmode
to false
.
- If
md
is true
:
- Set
SGdbprintmode
to true
.
- If no output is expected, print a message indicating that the debugging mode is "on" and provide a hyperlink to turn it off.
- Enable backtrace warnings using
warning('On','BACKTRACE')
.
- Set
dbmode
to true
.
Example Usage
The function can be tested within other functions using the following commands:
dbprintf
dbprintmode on
dbprintf
This example demonstrates toggling the debugging mode on and off.
Algorithm explaination created using ChatGPT on 2025-08-19 07:23. (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