Matrix extension in Simulink Embedded doesn't work, in Workspace does
이전 댓글 표시
Hi,
I have a simple question. I need in Embedded Matlab Function in Simulink run something like this:
Z = ones(15);
for i=16:1:20
for j=16:1:20
Z(i,j) = 0;
end;
end;
x = Z + ones(20);
This code doesn't work in Embedded Matlab Function. The error is: Size mismatch (size [15 x 15] ~= size [20 x 20]).
But if I try the same code run in Workspace, it works normally.
I don't know why. Is there any way or how can I do that in Embedded without the error?
Thanks a lot :-)
댓글 수: 1
Walter Roberson
2011년 2월 22일
By the way: instead of the loop, you could just use Z(20,20) = 0 to extend the matrix to 20 x 20 with 0's in all new positions (and explicitly set at that one position.)
This will not solve the problem of not being able to extend matrices in embedded Matlab before 2010b though.
채택된 답변
추가 답변 (1개)
Yucel
2011년 2월 22일
0 개 추천
Embedded should have "if" conditions,otherwise there can be problems like you had.
카테고리
도움말 센터 및 File Exchange에서 Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!