필터 지우기
필터 지우기

Function Error [scipt works, as interpreted function not]

조회 수: 2 (최근 30일)
Hakan Basargan
Hakan Basargan 2019년 10월 4일
답변: Hakan Basargan 2019년 10월 4일
Dear Team,
I have really annoying problem related to function.
I have 2 inputs for my function:
fncc.JPG
prob_ego input is aray: u = [a b c d e f]
location_ego is int loc
output : out = [g h i j k l] (each output is matrix [2x15] and converted to [1x30] by matlab.
If I don't use location_ego input; there isn't any problem. When I use that input (to calculate outputs), I receive error in Simulink although when I run as script; it works without error.
I use inputs of function as both :
function oout = prr(u)
a=u(1);
b=u(2);
c=u(3);
d=u(4);
e=u(5);
f=u(6);
g=u(7);
function oout = prr(u,g)
a=u(1);
b=u(2);
c=u(3);
d=u(4);
e=u(5);
f=u(6);
Error message what is received:
Invalid setting for input port dimensions of 'prrdeneme/Demux'. The dimensions are being set to 1.
This is not valid because the total number of input and output elements are not the same
Error in port widths or dimensions. Output port 1 of 'prrdeneme/Interpreted MATLAB Function' is a one
dimensional vector with 1 elements.
But I don't receive this error when I run the function as script.
Thank you in advance for your answers.
Best regards.

채택된 답변

Hakan Basargan
Hakan Basargan 2019년 10월 4일
I solved my problem by adding Signal Specification block output between demux and interpreted function.
Thanks

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by