从matlab .fig提取表面 [英] Extract surface from matlab .fig

查看:110
本文介绍了从matlab .fig提取表面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个matlab .fig文件,其中包含一些点和适合它们的表面.我想从图形中提取表面,并且希望同时具有顶点和面.您能为我提供一些有关如何实现这一目标的提示吗?

I have a matlab .fig file which contains some points and a surface fitted to them. I want to extract the surface from the figure, and I would like to have both the vertices and the faces. Could you please provide me some hints on how to achieve this?

我的身材可以在这里找到: https://drive.google .com/file/d/0By376R0mxORYU3JsRWw1WjllWHc/view?usp = sharing ,我想提取没有蓝点的表面.

My figure can be found here: https://drive.google.com/file/d/0By376R0mxORYU3JsRWw1WjllWHc/view?usp=sharing and I would like to extract the surface without the blue points.

它不是重复的,请参阅下面有关原因的评论.

it is not a duplicate, see my comment below as to why.

推荐答案

用于绘制表面和点的数据存储在图中.

The data used to plot either the surface and the dots are stored in the figure.

因此,您可以:

  • 打开图
  • 从图中获取数据
  • 获取图形的子代,在这种情况下为轴
  • 提取表面的轴,X,y和z数据

轴实际上包含两组数据:

The axes actually contains two set of data:

  • z(1)XDataYDataZData
  • 中存储的点的数据
  • z(2)XDataYDataZData
  • 中存储的表面数据
  • the data of the dots stored in the z(1) XData, YData, ZData
  • the data of the surface stored in the z(2) XData, YData, ZData

这是代码(带有点符号"):

This is the code (with "dot notation"):

% Open the figure
open('cubicinterp.fig')
% Get the data from the figure
x=gcf
% Get the children of the figure (in this case the axes)
y=x.Children
% Get the data used to plot on the axes
z=y.Children

figure
XX=z(2).XData;
YY=z(2).YData;
ZZ=z(2).ZData;
CCDD=z(2).CData;
surf(XX,YY,ZZ,CCDD)
return

这是不带点号的代码(在R2014b之前)

This is the code without the "dot notation" (before R2014b)

% Open the figure
open('cubicinterp.fig')
% Get the data from the figure
x=gcf
% Get the children of the figure (in this case the axes)
y_1=get(gcf,'children');
% Get the data used to plot on the axes
z_1=get(y_1,'children');

figure
XX=get(z_1(2),'xdata');
YY=get(z_1(2),'ydata');
ZZ=get(z_1(2),'zdata');
CCDD=get(z_1(2),'Cdata');
surf(XX,YY,ZZ,CCDD)

这是提取的表面:

希望这会有所帮助.

Qapla'

这篇关于从matlab .fig提取表面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆