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.

Comsol with MATLAB

Please login with a confirmed email address before reporting spam

Hi, I am trying to call a MATLAB function within COMSOL (in Global Definition). The m file simply reads and stores data from a text file by "fopen" command, and after some calculation and printing data to file using "fprintf", the file is closed using "fclose". While this m file runs in MATLAB, I am facing an error when calling it from COMSOL.

The error is "Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier."

So, is there any way to call an m file in COMSOL that deals with a text file (including opening, printing and closing)? Regards,


0 Replies Last Post 2020年10月6日 GMT-4 04:27
COMSOL Moderator

Hello Asal Bidarmaghz

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.

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.