Code Generation does not support scripts

I was trying to use %#codegen on my script. It has an error saying that codegen does not support scripts for A=cell(10,1). Is there any other techniques i can use to revise the code?
%#codegen
A=cell(10,1);
A{1}=[ -1,-1,-1;
-1,-1,-1;
-1,-1,-1;
+1,+1,+1;
+1,+1,+1;
+1,+1,+1];
A{2}=[ -1,-1,-1,-1,-1,-1;
-1,-1,-1,-1,-1,-1;
-1,-1,-1,-1,-1,-1;
+1,+1,+1,+1,+1,+1;
+1,+1,+1,+1,+1,+1;
+1,+1,+1,+1,+1,+1];
A{3}= [ -1,-1,-1,-1,-1,-1,-1,-1,-1;
-1,-1,-1,-1,-1,-1,-1,-1,-1;
-1,-1,-1,-1,-1,-1,-1,-1,-1;
+1,+1,+1,+1,+1,+1,+1,+1,+1;
+1,+1,+1,+1,+1,+1,+1,+1,+1;
+1,+1,+1,+1,+1,+1,+1,+1,+1];
A{4}=[ -1,-1,+1,+1;
-1,-1,+1,+1;
-1,-1,+1,+1;
-1,-1,+1,+1;
-1,-1,+1,+1;
-1,-1,+1,+1;
-1,-1,+1,+1;
-1,-1,+1,+1];
A{5}=[ -1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1;
-1,-1,-1,+1,+1,+1];
A{6}=[ -1,-1,-1,-1;
-1,-1,-1,-1;
-1,-1,-1,-1;
-1,-1,-1,-1;
+1,+1,+1,+1;
+1,+1,+1,+1;
+1,+1,+1,+1;
+1,+1,+1,+1];
A{7}=[ +1,-1,-1,+1;
+1,-1,-1,+1;
+1,-1,-1,+1;
+1,-1,-1,+1;
+1,-1,-1,+1;
+1,-1,-1,+1;
+1,-1,-1,+1;
+1,-1,-1,+1];
A{8}=[ +1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1;
+1,+1,-1,-1,+1,+1];
A{9}=[ +1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1;
+1,+1,-1,-1,-1,+1,+1];
A{10}=[ +1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1;
+1,+1,+1,-1,-1,-1,+1,+1,+1];

1 个评论

What would you like codegen to do differently for a script compared to wrapping into a function with the same name?

请先登录,再进行评论。

回答(1 个)

Try function process %#codegen
it works if it is a function .

类别

Community Treasure Hunt

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

Start Hunting!

Translated by