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.
Parameters in COMSOL with MATLAB
Posted Oct 22, 2018, 7:58 a.m. EDT Interfacing, LiveLink for MATLAB, COMSOL Server, Parameters, Variables, & Functions Version 5.0 1 Reply
Please login with a confirmed email address before reporting spam
Dear All, I used several parameters in COMSOL while creating a geometry. I imported this geometry into COMSOL with MATLAB. I need to use these parameters (initially created in COMSOL) in a loop at various places AS VARIABLES in COMSOL with MATLAB. Every time I need to use either function str2num before each parameter or need to remove inverted commas ( ' ' )for each and every parameter.
Example:
model.geom('geom1').feature('blk1').set('size', ['SampleLength' 'SampleWidth' 'SampleThickness']) will not work in a loop when using COMSOL server MATLAB WHILE IT IS THE DEFAULT ONE.
SampleLength, SampleWidth, SampleThickness are parameters and numerical value of these parameters is getting varied while in a loop.
Either model.geom('geom1').feature('blk1').set('size', [SampleLength 'SampleWidth SampleThickness]) OR
model.geom('geom1').feature('blk1').set('size', [str2num(SampleLength) str2num(SampleWidth) str2num(SampleThickness)]) will work in a loop when using COMSOL server MATLAB.
This exercise becomes tedious when there are lots of parameters.
Is there any other way out. Please kindly help me out.
Asha Sharma INDIA