[Gmsh] Gmesh to MATLAB

Jose Paulo Moitinho de Almeida moitinho at civil.ist.utl.pt
Tue Apr 26 13:44:58 CEST 2011


On Tuesday 26 April 2011, Zenker, Dr. Matthias wrote:
> Hi,
> 
> there is a script in the gmsh source distribution which reads in a msh
> file. You can find it under utils/converters/matlab/load_gmsh.m.
> 
> To produce your desired output, I think you will have to do a little bit of
> extra scripting.
> 

Not really

msh = load_gmsh2('a.msh', [])

Then:

% msh.POS(i,j) - j'th coordinate of node i (j in 1:3, i in 1:msh.nbNod)
% msh.ELE_NODES(i,j) - Nodes of element i (j in 1:k, with
%                       k = msh.NODES_PER_TYPE_OF_ELEMENT(msh.ELE_INFOS(i,2)))

Those are the Outputs solicited. How to manage them if there are different 
types of elements is another mater...

Regards

ZP


> HTH,
> 
> Matthioas
> 
> 
> ----------------------------------------------------------------
> ERBE Elektromedizin GmbH
> Dr.rer.nat. Matthias Zenker
> Dipl. Phys.
> Grundlagenentwicklung / Fundamental Development
> Waldhoernlestrasse 17
> 72072 Tuebingen
> Germany
> Phone + 49 (0) 7071 755 - 226
> Fax + 49 (0) 7071 755 - 5226
> E-Mail: <mailto:Matthias.Zenker at erbe-med.com>
> URL: http://www.ERBE-med.com
> ----------------------------------------------------------------
> 
> -----Ursprüngliche Nachricht-----
> Von: Gmsh User [mailto:amrit_pou at hotmail.com]
> Gesendet: Freitag, 22. April 2011 20:31
> An: gmsh at geuz.org
> Betreff: [Gmsh] Gmesh to MATLAB
> 
> Hello Gmsh users,
> I was just wondering whether there exits a MATLAB function that can read
> .msh file created by Gmsh software and returns output in the following
> format:
> 
> Output1: nodal coordinates = array of x y z coordinates of all the nodes
> (including the boundary nodes)
> 
> Output2 : nodal numbers = array of node numbers for each element
> 
> 
> I'd appreciate if somebody could point me to the appropriate resources
> where I can find such a MATLAB function.
> 
> Thank you for your time.
> 
> PS # I have Gmsh installed and running in MAC OX 10.6 .
> 
> 
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh