Function working as a matlab script but not working when copied into a simulink block (Matlab Function)
I am trying to use the following code inside a Matlab Function Block of Simulink, its giving me size mismatch error while building the model. But when the same code written as a matlab script and executed, works perfectly. I suspect there error arises because of how load function works for simulink. Can anyone explain to me how to modify the code to avoid this error?
data = coder.load("values.mat");
a = {data.w.l_0,data.w.l_1,data.w.l_2};
b = {data.g.l_0, data.g.l_1, data.g.l_2};
b = {data.s.l_0, data.s.l_1, data.s.l_2};
ctl = 0.0;
x = [0.3,0.03,0.03,0.03];
ctl = compute_output(x, a, b, c, 3);I am trying to use the following code inside a Matlab Function Block of Simulink, its giving me size mismatch error while building the model. But when the same code written as a matlab script and executed, works perfectly. I suspect there error arises because of how load function works for simulink. Can anyone explain to me how to modify the code to avoid this error?
data = coder.load("values.mat");
a = {data.w.l_0,data.w.l_1,data.w.l_2};
b = {data.g.l_0, data.g.l_1, data.g.l_2};
b = {data.s.l_0, data.s.l_1, data.s.l_2};
ctl = 0.0;
x = [0.3,0.03,0.03,0.03];
ctl = compute_output(x, a, b, c, 3); I am trying to use the following code inside a Matlab Function Block of Simulink, its giving me size mismatch error while building the model. But when the same code written as a matlab script and executed, works perfectly. I suspect there error arises because of how load function works for simulink. Can anyone explain to me how to modify the code to avoid this error?
data = coder.load("values.mat");
a = {data.w.l_0,data.w.l_1,data.w.l_2};
b = {data.g.l_0, data.g.l_1, data.g.l_2};
b = {data.s.l_0, data.s.l_1, data.s.l_2};
ctl = 0.0;
x = [0.3,0.03,0.03,0.03];
ctl = compute_output(x, a, b, c, 3); load, simulink MATLAB Answers — New Questions