Why cant I make this m-file exe?
Show older comments
I need to define some "syms" variables in my code. The number of these variables is not fixed, and user determines it. My program contains these lines.
a=[];b=[];c=[];d=[];e=[];f=[];nn=1
for i=1:N+2
a{nn}= strcat('D',num2str(i),'x');
b{nn}= strcat('D',num2str(i),'y');
c{nn}= strcat('D',num2str(i),'z');
d{nn}= strcat('O',num2str(i),'x');
e{nn}= strcat('M',num2str(i),'y');
f{nn}= strcat('M',num2str(i),'z');
nn=nn+1
end
as=[];bs=[];cs=[];ds=[];es=[];fs=[];nn=1;
for i=1:N+2
as{i}=sym(a(:,i));
bs{i}=sym(b(:,i));
cs{i}=sym(c(:,i));
ds{i}=sym(d(:,i));
es{i}=sym(e(:,i));
fs{i}=sym(f(:,i));
nn=nn+1;
end
my code in GUIDE works and it doesnt have any problem but When I make it exe, MATLAB returns this error: "Embeded MATLAB only supports cell operations for varargin and varargout." What's wrong?
1 Comment
Please don't overwrite your questions with new questions, especially once the previous question has been answered. Post completely new questions in completely new threads.
If you need to slightly edit your question, it is good practice to mark it clearly as an "EDIT".
In any case, my Answer below should still make it clear to you what the problem is. Embedded MATLAB only supports a subset of standard MATLAB and you are venturing outside this subset.
Answers (2)
Apparently, this is the problem
global N_Stiff
Embedded MATLAB doesn't support global variables, it sounds like. I don't work with Embedded MATLAB, so I can't comment further, but I do know that Embedded MATLAB doesn't support the entirety of normal MATLAB functionality. Neither does the MATLAB Compiler, although I don't recall that the MATLAB Compiler has any problems with global variables, so maybe you could try that.
1 Comment
Jan
on 12 Jul 2013
Because the author has changed the original question, this answer looks confusing. But I assume, that this answer has solved the original questions, such that selecting it as accepted answer would be the correct.
Please, Ftm, do not change the question after an answer was potsed.
Jan
on 12 Jul 2013
Isn't this a contradiction:
as = [];
for i = 1:N+2
as{i} = xyz
Even in Matlab this is not clean. A pre-allocation in the correct type would be better:
a = cell(1, N+2);
The error message tells you, that cells are supported for VARARGIN and VARARGOUT only. As far as I remember besides cells, the symbolic toolbox is not supported also. Please check this again.
Categories
Find more on Code Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!