How to create a Model Method and the Method Call node through Livelink for MATLAB?

Please login with a confirmed email address before reporting spam

Hi there,

I need to create a series of mph files and upload them to a third-party cloud of HPC for calculation.

In each mph file, a two-step parameter sweeping study is going to be performed for critical strain. The 1st step is a coarse sweeping, whose results determines the interval of a subsequent refined sweeping referred to as 'the 2nd step'.

I have discussed the implementation with chatGPT, and it suggests to use a Model Method code to control the process. Firstly, use Model Method to control the coarse sweeping step, and stop it as soon as negative eigenvalues emerge. Then, the strains corresponding to the current step and the previous step are identified as the higher and lower ends of the interval for the refined sweep in the following study.

After building the model through GUI, I try to save it as a .m file as usual. However, the .m file doesn't contain the code about create the 'Model Method' and the 'Method Call' node.


1 Reply Last Post Aug 12, 2026, 4:18 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 hours ago Aug 12, 2026, 4:18 a.m. EDT

Hi

You can do something like this to run a model method from Matlab:

m = model.methodCall.create('method1', 'method1')
m.run
-------------------
Lars Gregersen
Comsol Denmark
Hi You can do something like this to run a model method from Matlab: m = model.methodCall.create('method1', 'method1') m.run

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.