Syntax
smbAddBlock([SysName,BlockName,LibPath,BlockExt])
Input Parameter
SysName : | | System Name; default is gcs |
BlockName : | | Block name |
LibPath : | | Library path |
BlockExt : | | optional Block extension] |
Examples
smbAddBlock('','SINUS','simulink/Sources/Sine Wave')
Copyright 2016-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, smbAddBlock
, is designed to add a block to a Simulink or SimScape model. It is part of the SolidGeometry library and was introduced in version 3.1. The function takes up to four input parameters, which are used to specify the details of the block to be added.
Input Parameters
- SysName: The name of the system where the block will be added. If not provided, it defaults to the current system (
gcs
).
- BlockName: The name of the block to be added. If not specified, it defaults to 'testblock'.
- LibPath: The library path from which the block will be sourced. The default path is 'simulink/Continuous/Derivative'.
- BlockExt: An optional extension for the block name. It is an empty string by default.
Algorithm Steps
- Initialize
SysName
to the current system (gcs
) unless a different system name is provided as the first argument.
- Set
BlockName
to 'testblock' unless a different block name is provided as the second argument.
- Set
LibPath
to 'simulink/Continuous/Derivative' unless a different library path is provided as the third argument.
- Set
BlockExt
to an empty string unless a different block extension is provided as the fourth argument.
- Construct the full block name
BName
by concatenating SysName
and BlockName
with a '/' separator.
- Add the block to the system using the
add_block
function, specifying the library path and the full block name with the optional extension.
- Set the position of the newly added block using the
smbSetPosition
function.
- If there is an output argument, open the system in a tabbed view using
open_system
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:25. (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