In ISSM it is very easy to request anything that is stored as an Input
in C++ as a MATLAB result. Depending on what you are running, slopes may or may not be available. You can try md.stressbalance.requested_output = {'default',''SurfaceSlopeX','SurfaceSlopeY'};
and see what you get after you solve.
The problem is that the slopes will be defined at each vertex, which is not really how the normals are computed in ISSM. I think the best is to replicate the process that C++ is doing, but in MATLAB. For example, assuming you have a 2D plan view model, you can do:
%Get surface slope over each element
[sx,sy,s]=slope(md, md.geometry.surface);
%compute normal vector based on slope
nx = - sx./sqrt(sx.^2 + sy.^2 + 1);
ny = - sy./sqrt(sx.^2 + sy.^2 + 1);
nz = ones(md.mesh.numberofelements,1);
or something like that. If you are in 3D you can so something similar to Penta::NormalTop
in Penta.cpp
.
I hope this helps!
Mathieu