Undefined function for input arguments of type 'double' during Simulink
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Beatrice Pazzucconi
el 24 de Mayo de 2019
Comentada: Walter Roberson
el 10 de En. de 2023
Hello everyone, I created a simple script (TMAP.m) that has the current body:
function y = TMAP(u)
A = 40e+03;
B = 15e+03;
n = 1;
y = A*(u.^n).*exp(-B*u);
end
And I added the block "Interpreted Matlab function" to my Simulink model. I indicated "TMAP.m" in the block properties, fed a digital clock as input and connected to output to a scope. The TMAP script is in the same folder as the Simulink model. When in workspace I create a dummy input vector, say 0:0.001:0 and feed it to TMAP (eg y = TMAP(0:0.001:1)) it works just fine. When I try to run the Simulink model, I get these errors:
- Undefined function 'TMAP.m' for input arguments of type 'double'.
- Error evaluating MATLAB function in 'VelocitySelectiveRecordingTMAP/TMAP'
Can anybody tell me what I am doing wrong?
THank you very much for your help
NB - tried also having TMAP doing y = sin(u) to be sure but still refuses to work
5 comentarios
wei-jay ling
el 9 de En. de 2023
Editada: wei-jay ling
el 9 de En. de 2023
Hi, I have same problem, but I don't know your mean.
If I change the file name (like planer.m become planerA.m) then the system will show the warning to me.
the problem show below,please help me.


Walter Roberson
el 10 de En. de 2023
The original poster had the problem that inside their simulink block, at a place that they needed to refer to function TMAP they instead referred to function TMAP.m -- the file name instead of the function name. This had nothing to do with renaming anything, just with changing the way the function was referred to in the code.
There should be no need to rename planer.m to planerA.m .
If you do rename a file that has a function inside it as the first line non-comment, then you might get a warning message that the name in the function statement does not match the name of the file. If you renamed planer.m to planerA.m then best practice would be to also rename function planer inside the now-called planerA.m to function planerA inside that file.
In your case, Simulink is trying to find a function named planar (with an ar not an er) but is not succeeding. If you do have a planar.m file then it is not anywhere on your MATLAB path. You should consider using pathtool to ensure that th directory containing planar.m is on your MATLAB path.
Respuesta aceptada
Beatrice Pazzucconi
el 30 de Mayo de 2019
Editada: Beatrice Pazzucconi
el 30 de Mayo de 2019
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!