smbWhich

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 3.0, Creation date: 2016-11-19, Last change: 2025-09-14

return the full path name for a given block name

Description

This function looks for all systems and

See Also: smbNewSystem , smbFilename , smbPSLibname , smbPSLibCompile

Example Illustration

 missing image of smbWhich(BName)

Syntax

fullpath=smbWhich(BName)

Input Parameter

BName: Block name

Output Parameter

fullpath: full name of the block including system

Examples


tut_2016_11_16
smbWhich('LINK1.B')




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, smbWhich, is designed to find the full path name of a given block within a Simulink model. It is part of the SimMechanics library and was introduced in SolidGeometry 3.0.

Input Parameters

Output Results

Algorithm Steps

  1. Check if BName is empty. If it is, return an empty FullName and exit the function.
  2. Retrieve the full name of the current system using getfullname(gcs).
  3. Find the first occurrence of '/' in the current system's name to determine the base system name.
  4. Remove the system prefix from BName if it exists.
  5. Use find_system to get all blocks in the current system.
  6. Search for blocks that match BName using strfind.
  7. Iterate through the list of blocks to find the first match for BName.
  8. If a match is found, set FullName to the full path of the block. If no match is found, set FullName to an empty array.

Helper Function

The function fofcell is a helper function that checks if elements in a cell array are non-empty and returns a logical array indicating the presence of non-empty elements.

Algorithm explaination created using ChatGPT on 2025-08-19 01:10. (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