Variable size matrix in simulink

조회 수: 2 (최근 30일)
Metin
Metin 2014년 2월 25일
댓글: Metin 2014년 11월 14일
Hallo everybody, I have a question about variable size matrix in Simulink, I have seen some question and aswers as well but in mycase even I change configuration of my output vector, in both cases I got the error of:
Data (#213) is inferred as a variable size matrix, while its
specified type is something else.
I mean, I have tried both variable and fixed size output for embedded matlab file but it doesn't work, even the only think I want to do is to find out which elemeant of my vector (sized [48x1])is min so I check it with:
min_cell=find(min(U_cells)==U_cells,1,'first');
so it is fixed 1 demensional also I tried to set initially 0, but the same error persists on,in every case, thanks in advance:)

답변 (2개)

Danilo NASCIMENTO
Danilo NASCIMENTO 2014년 2월 25일
I think you should only set the command min(X), where X is the vector that you want to find the minimum element.

wisss
wisss 2014년 11월 14일
hi i have a problem with variable size matrix my code is:
if true
% code
function n_v = fcn(n_c)
%#codegen
a=n_c*8
y=zeros(1,a)
for i=1:a
y(i)=i
end
n_v=y;
end
the error is Data 'n_v' (#174) is inferred as a variable size matrix, while its specified type is something else.
  댓글 수: 1
Metin
Metin 2014년 11월 14일
Hi Wiss, if you want to ask a question please add your question as a comment, in your function you have to save your resulted array n_v in base workspace, to do this just add command below before ending your function,
assignin('base','n_v',n_v);
chaw

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by