by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 3.0, Creation date: 2016-11-11, Last change: 2025-09-14
smbCreateSubsystem(SSName)
SSName: | Namestring of a Subsystem |
This algorithm is a MATLAB function named smbCreateSubsystem from the SG-Library, designed to create and open a SimMechanics subsystem. Below is a detailed explanation of the algorithm and its parameters.
SSName is provided. If not, it defaults to 'Subsystem'.find_system to identify all blocks in the current system (gcs) with a search depth of 1. This means it only looks at the top-level blocks.smbConvertSubsystem with the SSName and all blocks found except the first one. This suggests that the first block might be the system itself or a block that should not be converted.nargin: This checks the number of input arguments. If no arguments are provided, it sets SSName to 'Subsystem'.find_system: This function is used to find blocks in the current system. The 'SearchDepth' parameter limits the search to the immediate children of the current system.smbConvertSubsystem: This function is called to perform the conversion of the identified blocks into a subsystem with the specified name.The algorithm is straightforward, focusing on creating a subsystem from existing blocks in a Simulink model. It assumes that the user is working within a Simulink environment and has a model loaded as the current system.
Algorithm explaination created using ChatGPT on 2025-08-18 22:19. (Please note: No guarantee for the correctness of this explanation)