Insert variable workspace in embedded MATLAB function
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Simulink Functions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!