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 Comment

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

Sign in to comment.

Answers (1)

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

Asked:

on 19 Jul 2017

Commented:

on 5 Nov 2018

Community Treasure Hunt

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

Start Hunting!