From: Harsh Dhingra on
Hi,

I have a 2D surface plot in Matlab depicting concentration values at any point on the surface. Was wondering how I could extract the data for it into a matrix of some sort. It would be useful to know how to do this for any surface plot in general 2D or 3D. Thanks in advance.
From: Walter Roberson on
Harsh Dhingra wrote:

> I have a 2D surface plot in Matlab depicting concentration values at any
> point on the surface. Was wondering how I could extract the data for it
> into a matrix of some sort. It would be useful to know how to do this
> for any surface plot in general 2D or 3D. Thanks in advance.

get(Plothandle, 'ZData')

is suitable for several of the kinds of surface plot, and

get(Plothandle, 'CData')

is suitable for several of the others.

Other kinds of 2D surface plots can get more complicated (e.g., contour
plots); rather than systematically go through and experiment to figure them
all out, perhaps you could indicate which ones you are interested in.

From: Harsh Dhingra on
I had a 3D FEM model in COMSOL which I ran from Matlab to get a 3D plot. I took one surface of the model and plotted it separately, from which I was trying to extract data. It is a colormap.
Thanks again.
From: Walter Roberson on
Harsh Dhingra wrote:
> I had a 3D FEM model in COMSOL which I ran from Matlab to get a 3D
> plot. I took one surface of the model and plotted it separately, from
> which I was trying to extract data. It is a colormap.

What plotting command did you use for the object you want to extract data from?
From: Harsh Dhingra on
Walter Roberson <roberson(a)hushmail.com> wrote in message <i2q4l0$49d$2(a)canopus.cc.umanitoba.ca>...
> Harsh Dhingra wrote:
> > I had a 3D FEM model in COMSOL which I ran from Matlab to get a 3D
> > plot. I took one surface of the model and plotted it separately, from
> > which I was trying to extract data. It is a colormap.
>
> What plotting command did you use for the object you want to extract data from?
I used postcrossplot to plot the surface, eg below:
postcrossplot(xfem,2,[1], ...
'surfdata',{'c','unit','mol/m^3'}, ...
'cont','internal', ...
'surfmap','Rainbow', ...
'title','Concentration, c [mol/m^3]', ...
'axislabel',{'s1','s2'}, ...
'refine','auto', ...
'geomnum',3);