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.

How to prevent the generation of mphm file during the connection with matlab

Please login with a confirmed email address before reporting spam

I used comsol 3.5a to build my model, and connection to matlab. Every step is fellowed from reset model to remesh and save to .m file. But when the .m file was saved, the geometry file flbinary file .mphm generated. I don't want this file, because the script was supposed to change in matlab to change the geometry parameter in the model. And in this condition the matlab script just reference the flbinary directly without any parameter of geometry in script. How to prevent the process? I tried to build everything from beginning, and comsol could remember the geometry para, however, even I save it to another file, the flbinary file generated. How could I do?

1 Reply Last Post 21 nov 2011, 17:35 GMT-5
COMSOL Moderator

Hello Daniel Zhang

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 21 nov 2011, 17:35 GMT-5
From the manual:

Separate File for Geometry Objects in Model M-Files

Sometimes the geometry objects in the draw section of a Model M-file, which defines fem.draw, are not generated from commands but saved in a separate file. This happens in the following cases:

• When you have opened a Model M-file and afterward used Reset Model in the File menu.
• When you have imported the geometry or the FEM structure from MATLAB.


The reason is that, in those cases, the information on how to generate the geometry from commands is lost.

When you save a Model M-file—such as under the name mymodel.m—COMSOL Multiphysics also saves a file mymodel.mphm with the geometry objects. In mymodel.m the variable flbinaryfile specifies the geometry file:

flbinaryfile = 'mymodel.mphm';

The geometry objects are defined by statements such as

g1 = flbinary('g1','draw',flbinaryfile);

The function flbinary loads the object, which is identified by the tags g1 and draw, from mymodel.mphm.
From the manual: Separate File for Geometry Objects in Model M-Files Sometimes the geometry objects in the draw section of a Model M-file, which defines fem.draw, are not generated from commands but saved in a separate file. This happens in the following cases: • When you have opened a Model M-file and afterward used Reset Model in the File menu. • When you have imported the geometry or the FEM structure from MATLAB. The reason is that, in those cases, the information on how to generate the geometry from commands is lost. When you save a Model M-file—such as under the name mymodel.m—COMSOL Multiphysics also saves a file mymodel.mphm with the geometry objects. In mymodel.m the variable flbinaryfile specifies the geometry file: flbinaryfile = 'mymodel.mphm'; The geometry objects are defined by statements such as g1 = flbinary('g1','draw',flbinaryfile); The function flbinary loads the object, which is identified by the tags g1 and draw, from mymodel.mphm.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.