[Gmsh] Understanding of variables

G. D. McBain gdmcbain at protonmail.com
Mon Nov 27 02:01:09 CET 2017

> I don't understand how to deal with the value of variables : I have 3 variables defining mesh size (a= 1, b=2, c=10). Mesh is OK and I want to export this mesh with the values of variables in the file name. I tried :
> Save StrCat("model", a, "_", b, "_", c, ".inp"); returns a syntax error.
> How can I extract the value of each variable to create a string ?

Try Sprintf rather than StrCat.

a = 1; b = 2; c = 10;
Printf(Sprintf("model%g_%g_%g.inp", a, b, c));



Note the use of %g despite the variables appearing to have integral values.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20171126/9021a3a9/attachment.html>

More information about the gmsh mailing list