首页 文章

从matlab中提取表面

提问于
浏览
1

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

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

编辑:这不是重复,请参阅下面的评论,为什么 .

1 回答

  • 2

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

    因此你可以:

    • 打开图

    • 从图中获取数据

    • 得到图中的孩子,在这种情况下是轴

    • 提取表面的轴,X,y和z数据

    轴实际上包含两组数据:

    • 存储在z(1) XDataYDataZData 中的点数据

    • 存储在z(2) XDataYDataZData 中的曲面数据

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

    % 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之前)

    % 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)
    

    这是提取的表面:

    enter image description here

    希望这可以帮助 .

    Qapla”

相关问题