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

2 visualizaciones (últimos 30 días)
Ruven Weiss
Ruven Weiss el 27 de Jul. de 2018
Editada: Ruven Weiss el 30 de Jul. de 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!!!

Respuestas (0)

Categorías

Más información sobre Simulink PLC Coder en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by