Simulink error: All inputs must be constant.

Hey,
I receive the following error message when trying to run the Simulink model.
All inputs must be constant.
P-code function 'p_file.p' produced an error.
Code of the Matlab Function Block:
function y = fcn(m,n)
y = p_file(m,n)
I can run p_file(1,12) from workspace without any problem.
Thank you for any suggestions!

5 件のコメント

Walter Roberson
Walter Roberson 2016 年 6 月 1 日
If you call
y = p_file(1,12);
in the Function Block, then does that work?
wkm42
wkm42 2016 年 6 月 1 日
Yes it does. I wonder why i didn't try it that way... Somehow n has to be defined in the Function block and not by a constant block. But it's alright, because only m will change anyway. Thanks for you help!
wkm42
wkm42 2016 年 6 月 1 日
Okay, im still confused why
y = p_file(1,12);
works, but
global n
y = p_file(1,n);
or n as constant block doesn't..
Walter Roberson
Walter Roberson 2016 年 6 月 1 日
編集済み: Walter Roberson 2016 年 6 月 1 日
Sorry, I do not know about that.
Does the p_file use the signal processing toolbox?
wkm42
wkm42 2016 年 6 月 2 日
Probably it does, but i don't know it for sure, cause i don't have the .m file. It's some kind of filter.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Functions についてさらに検索

製品

質問済み:

2016 年 6 月 1 日

コメント済み:

2016 年 6 月 2 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by