Why I get "Fcn Block has a syntax error"?
15 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Walter Roberson
2016-3-7
编辑:Walter Roberson
2016-3-7
I do not see anything obvious. You could try retyping it again without any spaces just in case there is an extra blank that I am overlooking. I suspect that will not help.
However, you appear to be using an Interpreted MATLAB Block. Interpreted MATLAB Blocks can only have a single input, and so only a single variable name. There does not appear to be any way for the code to know where to retrieve a0, af, bf, n, or p. If you want to use multiple inputs, even if the inputs are constants, then you need to use a MATLAB Function Block (formerly known as an Embedded Function Block).
There is a possibility that you might be able to code something like
evalin('base', 'a0') + evalin('base', 'af') .* cos(evalin('base', n') * ..... etc
I do not know if it would be able to recognize that code or not. If it did, then the constants would have to be in the base workspace similar to if you had been using a From Workspace block.
My guess is that Interpreted MATLAB Blocks can only refer to one variable in their code.
5 个评论
Walter Roberson
2016-3-7
About slprj: see http://www.mathworks.com/matlabcentral/answers/90318-how-can-i-stop-my-simulink-model-from-generating-slprj-folder-and-mex-files
To bring in values for a0, af and so on for a MATLAB Function Block, add input ports to the block and bring in the values from somewhere appropriate. Perhaps from a Constant Block.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!