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

1 vue (au cours des 30 derniers jours)
Ruven Weiss
Ruven Weiss le 27 Juil 2018
Modifié(e) : Ruven Weiss le 30 Juil 2018
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!!!

Réponses (0)

Catégories

En savoir plus sur Simulink PLC Coder dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by