- First, open bus editor and define a new bus object.
- Click on Add Element and add the vector element as double.
- Click on Edit Array next to vector field and set its dimension to [1 N].
- Click Ok and save.
- Now, you can use your matlab code with [1 N] dimension.
Bus with array of fixed size determined by function block set in buseditor
2 次查看(过去 30 天)
显示 更早的评论
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] ?
0 个评论
回答(1 个)
Anuj
2023-7-13
Hi Anna,
Yes, you can set vector dimension in bus editor usign following steps -
Refernce of dimension edit - Specify properties of elements of buses - MATLAB - MathWorks India
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!