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.

Importing geometry coordinates from MATLAB to COMSOL

Please login with a confirmed email address before reporting spam

Hi, I have generated x and y coordinates in MATLAB for a square spiral coil, which is saved as a .txt file. I am having trouble importing the coordinates to COMSOL. 1) What type of file does COMSOL accept? 2) In which format should the coordinates be saved to be imported successfully?

Thanks in advance! Divya



2 Replies Last Post May 11, 2022, 12:31 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 3 years ago May 10, 2022, 2:39 a.m. EDT

Hi Divya

It depends.

If you just want to create a curve in 2D based on your coordinates then just insert a Polygon (listed under More Primitives). Choose the data source as File and select the Type as "Open curve".

The file formats that are supported by Comsol are described in the Programming Reference Manual in the section titled "The COMSOL File Formats". In addition Comsol is able to read a number of CAD file formats if you have the CAD Import Module or one of the LiveLink modules. You want to use the spreadsheet file format. I've attached a very simple file you can use as an example.

If you wish to create a more advanced geometry then we need more information.

-------------------
Lars Gregersen
Comsol Denmark
Hi Divya It depends. If you just want to create a curve in 2D based on your coordinates then just insert a Polygon (listed under More Primitives). Choose the data source as File and select the Type as "Open curve". The file formats that are supported by Comsol are described in the Programming Reference Manual in the section titled "The COMSOL File Formats". In addition Comsol is able to read a number of CAD file formats if you have the CAD Import Module or one of the LiveLink modules. You want to use the spreadsheet file format. I've attached a very simple file you can use as an example. If you wish to create a more advanced geometry then we need more information.


Please login with a confirmed email address before reporting spam

Posted: 3 years ago May 11, 2022, 12:31 a.m. EDT

Thank you Lars!

I wanted to create a curve in 2D and it works. The reference txt file was helpful , I arranged my coordinate data in a spreadsheet format.

Thank you Lars! I wanted to create a curve in 2D and it works. The reference txt file was helpful , I arranged my coordinate data in a spreadsheet format.

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.