필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

emlc mxArray issue

조회 수: 2 (최근 30일)
Jeremiah
Jeremiah 2011년 7월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I'm fairly new to Matlab Embedded Coder and i have issue regarding the mxArray. The error shown is
??Subscripting into an mxArray is not supported.
And i have the piece of code here:-
Ab1 = (xmax + rand(S1,R).*(xmin-xmax))./2;%will transfer into 5 x 9 matrix
Ab2 = (ymax + rand(S2,S1).*(ymin-ymax))./2;%will transfer into 5 x 9 matrix
b1=(a + (b-a) *rand(S1,1)); % Weights between Input and Hidden Neurons
b2=(a + (b-a) *rand(S2,1)); % Weights between Hidden and Output Neurons
n1=Ab1*Ab;
A1 = logsig(n1);
n2=Ab2*A1;
%Line with error specified
Cc = n2(:,i)* Ab(i,:); %find a way to get it supported by emlc because n2(:,1)and Ab(i,:)can be broken up in C
g = (Cc./beta) .* exp(-fitin);
c = logsig(n2)+ Cc + g;
C = c - 1;%C is the matrix containing the clones generated from this calculation
e=C-T;
error =0.5* mean(mean(e.*e));
The error message seem to be located in the Cc equation where the n2(:,i)* Ab(i,:) is described. Seems to me that the emlc doesn't support this piece of function.

답변 (2개)

Rick Rosson
Rick Rosson 2011년 7월 28일
  1. Could you please fix the indentation of the code in your question to make it a bit easier to read?
  2. I do not see where you have defined or pre-allocated the variable Ab, which you are referencing in the expression on assigned to the variable Cc. Did you define or pre-allocate Ab in some earlier code that you are not showing here?
  3. If not, please try to pre-allocate or initialize Ab before you use it in an expression.
HTH.
Rick

Mike Hosea
Mike Hosea 2011년 7월 28일
The LOGSIG function is not supported for code generation, so you must have declared it extrinsic. Read the documentation about declaring things extrinsic. There should be some examples there that show you how to make it work in Simulink or in MATLAB if you are building a mex file (you need to pre-define the output type of each call). Nothing will make an extrinsic function work for an embedded target--that's a contradiction. That is to say, if you are generating code for it, it's not extrinsic. If it's extrinsic, you aren't generating code for it (just using the MATLAB that is running on your computer). -- Mike

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by