Bus with array of fixed size determined by function block set in buseditor

6 ビュー (過去 30 日間)
Anna Fontana
Anna Fontana 2023 年 7 月 12 日
回答済み: Anuj 2023 年 7 月 13 日
Hi everyone,
I have a MATLAB system which has the stepImpl method defined as follows:
function out_bus = stepImpl(obj, N);
obj.vector = ones([1 N]);
out_bus = struct('vector', obj.vector);
end
where the field "vector" is an array of fixed sized determined by N (compute in a previous block of a matlab function).
Is it possible to tell the buseditor that the dimension is exactly [1 N] ?

回答 (1 件)

Anuj
Anuj 2023 年 7 月 13 日
Hi Anna,
Yes, you can set vector dimension in bus editor usign following steps -
  1. First, open bus editor and define a new bus object.
  2. Click on Add Element and add the vector element as double.
  3. Click on Edit Array next to vector field and set its dimension to [1 N].
  4. Click Ok and save.
  5. Now, you can use your matlab code with [1 N] dimension.

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by