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!