Reputation: 1
please,
I want matlab to generate dynamic variable name as many as specified number ex, generate F1,F2,...
but the problem that I want to differienate the unspeceified number I use
for k = 1:number
eval(diff(['F', num2str(k)]))
end
so what's wrong?
Upvotes: 0
Views: 37
Reputation: 36720
You should start your code with:
f=sym('f',[1,number])
this creates symbolic variables f1... organised in an array.
for k = 1:number
diff(f(k))
end
Avoid eval whenever possible. For reasons read doc eval
.
Upvotes: 1