Can't delete MATLAB Function Input in Simulink?

1 次查看(过去 30 天)
Hello,
In my Simulink model i have a MATLAB Function that used to have three inputs. Now i don't need one of these inputs anymore and (of course) decided to delete it. As soon as i do so i can't run my Simulink model anymore even tho the variable is not even used by the functions code! The error I was getting was:
"Errors occurred during parsing of MATLAB function ..... "
I've rewrittten the code but still the same error appeared.
Now even tho I didn't try anything diferen't i keep getting the Error
"Simulink cannot determine sizes and/or types of the outputs for block 'lca_simulink/Lane Changing Assist/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs."
I tried defining the Output-type in the Model Explorer but that didn't change anything. Is this just a random error or did I do anything wrong?
This is the function and "xObjMemoryOld" is the variable i want to delete. As you can see it's not in the code... if i just leave it in there and leave it unconnected my Model runs perfectly? isn't this weird?
function [RearClearMemory, RearClearSmooth]= SmoothenRearClearSignal(RearClearMemory,RearClear,xObjMemoryOld)
RearClearRelevant = RearClearMemory(~isnan(RearClearMemory));
if length(RearClearMemory) > length(RearClearRelevant)
RearClearMemory(length(RearClearRelevant) + 1) = RearClear;
else
RearClearMemory(1:end-1) = RearClearMemory(2:end);
RearClearMemory(end) = RearClear;
end
RearClearRelevant = RearClearMemory(~isnan(RearClearMemory)); % so last value is also used
RearClearSmooth = median(RearClearRelevant(:));
if RearClearSmooth == 0.5
RearClearSmooth = 0;
end
if length(RearClearRelevant) <= 5
RearClearSmooth = 1;
end
Thanks for your help,
Timmy

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Event Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by