smbGetSubSystempath

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 3.1, Creation date: 2016-12-04, Last change: 2025-08-18

smb returns the filepath of the current block

Description

try also fileparts(gcb)

See Also: smbWhich , smbGetLibraryPath , smbGetBlockInfo

Example Illustration

 missing image of smbGetSubSystempath(block)

Syntax

[SubName,block]=smbGetSubSystempath(block)

Input Parameter

block:

Output Parameter

SubName:
block:

Examples

Click on a block in simulink or simscape and call
smbGetSubSystempath




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, smbGetSubSystempath, is designed to retrieve the file path of a specified block within a Simulink or Simscape model. It is part of the SolidGeometry library and was introduced in version 3.1.

Input Parameters

Output Results

Algorithm Steps

  1. The function begins by calling smbWhich(block), which processes the input block to determine its full path within the model. This function is assumed to resolve the block's path, similar to the which function in MATLAB that finds the path of a file or function.
  2. The processed block path is then stored back into the variable block.
  3. The function uses strfind(block,'/') to locate all occurrences of the forward slash character '/' in the block path. This is used to identify the hierarchical structure of the model path.
  4. The variable a stores the indices of all slashes found in the block path.
  5. SubName is then determined by extracting the substring from the start of the block path up to the last slash, effectively removing the block name itself and leaving only the path to the subsystem.

The function is useful for users who need to programmatically determine the location of a block within a larger model hierarchy, which can be helpful for model analysis or manipulation tasks.

Algorithm explaination created using ChatGPT on 2025-08-18 22:50. (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