Insert variable workspace in embedded MATLAB function
显示 更早的评论
Hello, I find the following problem when I try to load a .mat file (containing parameters) into a simulink block (embedded MATLAB function). That is:
function y = fcn(u)
%#eml
load('var_mod');
if u <= L
y = go;
elseif u > L && u < L+s+(dp/2)
y = sqrt((u - L)^2 + go^2);
elseif u >= L+s+(dp/2) && u < L+d
y = (sqrt((-u + L + d)^2 + go^2));
else
y = go;
end;
Where L, d, go and so on should be read from the file var_mod.
The compilation gives the following error:
Function 'load' implicitly resolved in the MATLAB workspace. Implicit evaluation in MATLAB is not supported. Please declare this function extrinsic using eml.extrinsic('load'), or call it using feval.
Function 'Embedded MATLAB Function' (#18.27.42), line 4, column 1:
"load('var_mod')"
Launch diagnostic report.
How can I solve this?
Thanks
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!