smlDeleteall

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 4.7, Creation date: 2019-08-04, Last change: 2025-09-14

delete all lines and block of a block diagram



See Also: smbDeleteUnconnectedLines

Example Illustration

 missing image of smlDeleteall(asys,typ)

Syntax

smlDeleteall([asys,typ])

Input Parameter

asys: default is gcs
typ: default is {'line','block}

Examples


new_system('SGLib_Arduino_Example','FromFile','Example_Arduino.slx'); open_system('SGLib_Arduino_Example');
smlDeleteall(gcs,'line')




Copyright 2019-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, smlDeleteall, is designed to delete all lines and blocks from a specified block diagram in MATLAB. It is part of the SolidGeometry library and was introduced in version 4.7.

Input Parameters

Algorithm Steps

  1. The function begins by retrieving the input parameters using the helper function getfuncparams. If no parameters are provided, it defaults to the current system and both 'line' and 'block' types.
  2. It checks if the typ parameter is a cell array. If it is, the function iterates over each element in the array, recursively calling smlDeleteall for each type specified.
  3. If typ is not a cell array, the function uses find_system to locate all elements of the specified type within the system asys. The 'FindAll','on' options ensure that all matching elements are found.
  4. Once the elements are identified, the function deletes them using the delete command.

Example Usage

The example provided in the code demonstrates how to use the function:

new_system('SGLib_Arduino_Example','FromFile','Example_Arduino.slx'); 
open_system('SGLib_Arduino_Example');
smlDeleteall(gcs,'line')

This example creates a new system from a file, opens it, and then deletes all lines from the current system.

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