smlNewSystem
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 4.7, Creation date: 2019-08-03, Last change: 2025-09-14
opens a new simulink sheet - overwrites an exiting one
Description
The Coder parameters are taken from a file named 'Example_Arduino.slx'.
If this file is missing, try loadweb ('Example_Arduino.slx',true);
See Also: smbNewSystem
Example Illustration
Syntax
smlNewSystem([SName,Coder])
Input Parameter
SName: | | Name of the new system such as |
Coder: | | Name of Sheet Example; default is 'arduino' |
Examples
smlNewSystem('SGLib_Arduino_Example')
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, smlNewSystem, is designed to create a new Simulink system or overwrite an existing one. It is part of the SolidGeometry library and was introduced in version 4.7. The function takes two optional input parameters: SName and Coder.
Input Parameters
- SName: The name of the new system. If not provided, it defaults to 'SGLib_test_sml_lib'.
- Coder: The name of the sheet example. The default value is 'Arduino'.
Algorithm Steps
- Retrieve the input parameters using the
getfuncparams function. If not provided, default values are used.
- Display a message indicating that the system will be cleared and overwritten if it already exists.
- Attempt to save the current system state using
save_system. If the system is open, close it using close_system without saving changes.
- Check if a file with the name
SName.slx exists. If it does, delete the file.
- Use a
switch statement to handle different Coder values:
- Case 'arduino':
- Display a message indicating preparation for coding an Arduino board.
- Create a new system from the file 'Example_Arduino.slx' using
new_system with the 'FromFile' option.
- Otherwise:
- Create a new system using
new_system with the 'Model' option.
- Call
smlDeleteall to delete all elements in the new system.
- Open the new system using
open_system with the 'force' option to ensure it opens even if it is already open.
- Save the new system using
save_system.
Algorithm explaination created using ChatGPT on 2025-08-19 08:07. (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