Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 428

How to remove the history record in the m-file exported from COMSOL

$
0
0
Hello all,

I hope this is not a silly question. With "Save as Model M-file", COMSOL can generate a m-file that can be used in MATLAB with LiveLink.

But I realized that the generated m-file contains every step I did in COMSOL GUI. For example, if you set the Geometry Import several times in COMSOL, specified "1.mphbin" first, then imported. And you realized you chose the wrong file. You then changed to "2.mphbin", imported. You realized you did it wrong again.....

After changing the filename several times, you export the model to a m-file. It will look like:

model.geom('geom1').feature('wp1').geom.feature('imp1').set('filename', '1.mphbin');
model.geom('geom1').feature('wp1').geom.feature('imp1').importData;
model.geom('geom1').feature('wp1').geom.feature('imp1').set('filename', '2.mphbin');
model.geom('geom1').feature('wp1').geom.feature('imp1').importData;
model.geom('geom1').feature('wp1').geom.feature('imp1').set('filename', '3.mphbin');
model.geom('geom1').feature('wp1').geom.feature('imp1').importData;
model.geom('geom1').feature('wp1').geom.feature.remove('imp1');
model.geom('geom1').feature('wp1').geom.feature.create('imp1', 'Import');
model.geom('geom1').feature('wp1').geom.feature('imp1').set('filename', '1.mphbin');
model.geom('geom1').feature('wp1').geom.feature('imp1').importData;
model.geom('geom1').feature('wp1').geom.runAll;

But it is pretty clear that the first 7 lines don't make any sense. The problem not only exists for geometry, it also exists for mesh, solver, and so on.

Is there a way to remove all the history actions so I can get a clean m-file?

Thanks.

Best,
Kan

Viewing all articles
Browse latest Browse all 428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>