Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Increment of Variable/Argument name used in Function
Posted 27 avr. 2011, 14:14 UTC−4 Interfacing, Parameters, Variables, & Functions Version 4.1 3 Replies
Please login with a confirmed email address before reporting spam
Hi,
I'm trying to increment variable name in a command:
___________________
ie: model.geom('geom1').feature.create('b1', 'BezierPolygon');
Here I'll like to increment 'b1' each time loop is passing over this command (considering the command into a if loop per example)
____________________
Usually, I use evalc to increment matrix name in Matlab:
____________________
for i=1:10
evalc(['b' num2str(i) '=zeros(N,N)'])
end
____________________
Here it doesn't work, since Matlat interpret this as an undefined variable (since I do not assign anything to the variable)
I'm sur it is not complicated !
Any help would be appreciated.
I'm trying to increment variable name in a command:
___________________
ie: model.geom('geom1').feature.create('b1', 'BezierPolygon');
Here I'll like to increment 'b1' each time loop is passing over this command (considering the command into a if loop per example)
____________________
Usually, I use evalc to increment matrix name in Matlab:
____________________
for i=1:10
evalc(['b' num2str(i) '=zeros(N,N)'])
end
____________________
Here it doesn't work, since Matlat interpret this as an undefined variable (since I do not assign anything to the variable)
I'm sur it is not complicated !
Any help would be appreciated.
3 Replies Last Post 28 avr. 2011, 20:48 UTC−4