smbGetPortofFrame

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

returns the subsystem Port for a given subsystem Frame



See Also: smbNewSystem , SGmodelLink , SGmodelLink , smbCreateJoint

Example Illustration

 missing image of smbGetPortofFrame(FName)

Syntax

PName=smbGetPortofFrame(FName)

Input Parameter

FName: Frame Name in a Subsystem

Output Parameter

PName: Name of Port in the Current System

Examples

Show the Port Name of the Origin Frame
smbNewSystem ('untitled');
smbGetPortofFrame('WORLD.ORIGIN')




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, smbGetPortofFrame, is designed to retrieve the port name associated with a given frame name within a Simulink subsystem. The function is part of the SimMechanics library and was created by Tim Lueth in November 2016.

Input Parameters

Output Results

Algorithm Steps

  1. The function begins by calling smbGetAllPorts(gcs), which retrieves all ports in the current system. The function returns three outputs, but only the third output, c, is used in this function.
  2. c is expected to be a cell array where each row contains information about a port. The third column of each row contains the frame name associated with that port.
  3. An empty variable PName is initialized to store the port name if a match is found.
  4. A for loop iterates over each row of c:
  5. After the loop, if PName is not empty, the function removes the current system's name from PName using strrep. This is done to ensure that the port name is relative to the current system.
  6. The function returns PName as the output.

Example Usage

To demonstrate the function, the example provided shows how to retrieve the port name for the frame 'WORLD.ORIGIN' in a system named 'test_smb_lib':

smbNewSystem('test_smb_lib');
smbGetPortofFrame('WORLD.ORIGIN');
Algorithm explaination created using ChatGPT on 2025-08-18 22:36. (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