- Could you please fix the indentation of the code in your question to make it a bit easier to read?
- 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?
- If not, please try to pre-allocate or initialize Ab before you use it in an expression.
Info
この質問は閉じられています。 編集または回答するには再度開いてください。
emlc mxArray issue
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (2 件)
Rick Rosson
2011 年 7 月 28 日
HTH.
Rick
0 件のコメント
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
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!