How to assign values to a matrix with a for loop when using PLC Coder?

2 ビュー (過去 30 日間)
Ruven Weiss
Ruven Weiss 2018 年 7 月 27 日
編集済み: Ruven Weiss 2018 年 7 月 30 日
Hello, I have a simulink model containing a user defined Matlab function that I want to generate PLC code from. Within that function I am assigning some values to a matrix uising a for loop.
Mini Code Example:
function y = fcn()
U = zeros(30, 30);
for i=1:2
U(i:30, i) = ones(31-i,i);
end
y = U;
When I check the subsystems compatibility for PLC Code Generation in simulink I get the following error:
"Variable-size arrays are currently disabled for code generation. Consider selecting the 'Support variable-size signals' option on the Configuration Parameters > Code Generation > Interface page."
Does anybody know how to solve this?
(When I write the assignment line by line by hand, it works perfectly fine. But in practice I have a lot more than 2 assignments. Thats why I want to use a for loop)
Thanks for any advice!!!

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink PLC Coder についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by