フィルターのクリア

Enabling bus sorting by name in the Simulink Type Editor

2 ビュー (過去 30 日間)
Grigorii Nefedov
Grigorii Nefedov 2024 年 1 月 9 日
編集済み: Grigorii Nefedov 2024 年 1 月 11 日

How to enable bus sorting by name in the Simulink Type Editor?

  3 件のコメント
Harimurali
Harimurali 2024 年 1 月 10 日
編集済み: Harimurali 2024 年 1 月 10 日
Hi Girgorii,
Bus elements are typically displayed in the order in which they are defined or added to the bus object. However, the elements can be manually reordered using a MATLAB script.
Here is an example MATLAB script to sort the bus elements:
%Create bus elements
elems(1) = Simulink.BusElement;
elems(1).Name = 'Sine';
elems(2) = Simulink.BusElement;
elems(2).Name = 'Chirp';
elems(3) = Simulink.BusElement;
elems(3).Name = 'Bees';
%Create the bus object
Sinusoidal = Simulink.Bus;
Sinusoidal.Elements = elems;
% Get the elements of the bus object
elements = Sinusoidal.Elements;
% Sort the elements by name
[~, idx] = sort({elements.Name});
sortedElements = elements(idx);
% Assign the sorted elements back to the bus object
Sinusoidal.Elements = sortedElements;
For nested bus, apply the similar sorting logic recursively to each bus.
Hope this helps.
Grigorii Nefedov
Grigorii Nefedov 2024 年 1 月 11 日
編集済み: Grigorii Nefedov 2024 年 1 月 11 日
I want to sort buses in Type Editor window, not bus elements.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Model Editing についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by