• Регистрация
MatlabsteR
MatlabsteR 0.00
н/д

Expected either a logical, char, int, fi, single, or double. Found an mxArray."

13.01.2020

Ребята, подскажите что значит эта ошибка и как ее устранить?

 

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.
 
Expected either a logical, char, int, fi, single, or double. Found an mxArray.
MxArrays are returned from calls to the MATLAB interpreter and are not supported inside expressions.
They may only be used on the right-hand side of assignments and as arguments to extrinsic functions.

Код:

 

function x= fcn(u, y,A1,L1,b,C)
coder.extrinsic('evalin')
coder.extrinsic('evalin')
coder.extrinsic('sscanf')
coder.extrinsic('fgets')
fileID = fopen("result.txt", "r");
file = fgets(fileID)
value = sscanf(file, '%g', [1,2]) %
x1 = value(1,1)
x2 = value(1,2)
value=double([x1;x2])
if value(1,1) < 1   
x3=[10;20];
end
x_predicted=A1*x3+b*u 
x_est1=x_predicted+L1*(y-C'*x_predicted)%Filterung
x3 = x_est1
x_est = x_est1;

Теги

    13.01.2020

    Ответы

    • _______ ____________
      _______ ____________ -1.52
      15.01.2020 14:00

      Я полагаю вы хотите использовать эту функцию внутри блока Simulink. Соответственно, u, y,A1,L1,b,C будут входами в блок, а x выходом. Вот только в приведенном коде выходу ничего не присвоено, вот он и в недоумении, зачем все это делать, если никакого эффекта от этого не будет, ну и тип выходного сигнала для него тоже загадка.