[Gmsh] using load_gmsh4.m

Jose Paulo Moitinho de Almeida moitinho at civil.ist.utl.pt
Mon Oct 15 11:24:41 CEST 2018


Hello

In the function declaration 'filename' is an argument which when you call the 
function gets replaced by whatever name you use. If you use a constant string 
as a variable you get a syntax error.

So, after putting 'filename' back in the beginning of the function definition 
(without quotes) you should just write at the matlab command prompt ">>".

m=load_gmsh4('cube');

and it should work. Inside the call the content of variable 'filename' becomes 
'cube'.

Notes:
- gmsh files normally have the extension .msh 
If you change the extension you have to add the extension to the name in the 
function call;
- you can use whatever name you like for the variable that is returned. 
For example
my_mesh=load_gmsh4('cube');
or even load two meshes simultaneously
my2D = load_gmsh4('square.msh');
my3D = load_gmsh4('cube.msh');

Hope this helps. Good luck

ZP



On segunda-feira, 15 de outubro de 2018 04:36:05 WEST Abiti Adili wrote:
> Dear Sir:
> 
> Using the advice from  a couple of kind repliers, I was able to save my msh
> file in version 2 format. I wanted to export my msh file into Matlab to
> generate my tetrahedral mesh on a unit cube. So I tried load_gmsh4.m
> function, but  when I write filename(which is 'cube') in the very beginning
> for the function definition, Matlab is not taking it. I  am guessing that I
> am doing something fundamentally wrong here but I just  could not figure
> out how to get the load_gmsh4.m running correctly.
> 
> I have attached the syntax error message, the load_gmsh4.m, and the  msh
> file in version 2 format(cube). I would greatly appreciate if anyone could
> take a look at it and maybe point me to the right direction.
> 
> Thank you very much for your time.
> 
> Adil





More information about the gmsh mailing list