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 export the surface plot data from comsol to matlab?

Please login with a confirmed email address before reporting spam

Dear all,

I am using comsol 4.2a. I want to export the surface plot data in comsol to Matlab.
Kindly let me know how can i do this?
Thank you

1 Reply Last Post 10 juin 2014, 05:44 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10 juin 2014, 05:44 UTC−4
Hi Paul,

In your results node there is an export node. Add a data subnode to that. In that node, define the expression that you want to evaluate and export. What I did was leave 'points to evaluate in' at 'take from data set'. This will result in a table with one row per grid point, with its x- and y-position and the value at that position. You can import the generated file in matlab and interpolate it there to values at any x- and y- position (for example a uniformly distributed rectangular grid) using the 'griddata' function.

You can also interpolate to a rectangular grid while exporting but this leads to a loss of data.
Hi Paul, In your results node there is an export node. Add a data subnode to that. In that node, define the expression that you want to evaluate and export. What I did was leave 'points to evaluate in' at 'take from data set'. This will result in a table with one row per grid point, with its x- and y-position and the value at that position. You can import the generated file in matlab and interpolate it there to values at any x- and y- position (for example a uniformly distributed rectangular grid) using the 'griddata' function. You can also interpolate to a rectangular grid while exporting but this leads to a loss of data.

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.