Not have enough information to determine output sizes

조회 수: 86 (최근 30일)
Michael
Michael 2014년 7월 15일
답변: omar sheishaa 2018년 12월 9일
Dear all,
My Problem:
Simulink does not have enough information to determine output sizes for
this block. If you think the errors below are inaccurate, try specifying
types for the block inputs and/or sizes for the block outputs.
The idea:
I have an Input Parameter with two Information 1x2 Matrix using only the second Information in this example, but it does not work.
My Simulink realisation with Threashold (Switch1 = 80) and InitialCondition (Memory2 = 50):
The MATLAB Function contains:
function y = fcn(u)
persistent y_
if isempty(y_)
y_ = 50;
end
y = y_ + u(2,1) - 20;
y_ = y;
My question:
How can I handle this problem? Why is the output of my MATLAB Function and Memory2 not defined as "1"? Can I define the output variable to fix this problem?

채택된 답변

Kaustubha Govind
Kaustubha Govind 2014년 7월 15일
I think it is the loop in your model that is confusing Simulink propagation. You may want to insert a Signal Specification block right before the MATLAB Function block, and specify the signal dimensions.

추가 답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 15일
In your function you are using the second element of u, remove the mux block, and just connect the switch output to your function.
  댓글 수: 2
Michael
Michael 2014년 7월 15일
Hi,
I have already done this and this would work well, but... in the "complete" function I am using the first Input of the mux block to generate the output (y). Is there a different possibility?
Best regards, Michael
Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 15일
Look at Kaustubha's answer

댓글을 달려면 로그인하십시오.


omar sheishaa
omar sheishaa 2018년 12월 9일
i have a problem while depolying the below model on android device "Simulink cannot determine sizes and/or types of the outputs for block 'slexHARAndroidExample/predictActivity' 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." although it worked before
my model is as below
Capture.PNG
also below is the code of the "predictactivity" block
function y = predictActivity(u)%#codegen
% predictActivity - predict human activity based on trained model stored in
% EnsembleModelAndroid.mat file.
% Copyright 2017 The MathWorks, Inc.
persistent mdl;
if isempty(mdl)
mdl = loadCompactModel('EnsembleModel.mat');
end
y = predict(mdl,u);
end

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by