Function Error [scipt works, as interpreted function not]
2 views (last 30 days)
Show older comments
Hakan Basargan
on 4 Oct 2019
Answered: Hakan Basargan
on 4 Oct 2019
Dear Team,
I have really annoying problem related to function.
I have 2 inputs for my function:
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.
0 Comments
Accepted Answer
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!