How to assign values to a matrix with a for loop when using PLC Coder?
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Simulink PLC Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!