MATLAB App Designer,图形绘图(非数字数据)

时间:2017-03-04 14:32:02

标签: matlab plot graph visualization matlab-app-designer

Matlab App设计器中的

UIAxes不支持非graph图等非数字数据,在UI框架内有没有其他选择?

在指南中我这样做:

% --- Executes on button press in Visualize.
function Visualize_Callback(hObject, eventdata, handles)
a = [1 2 3 4];
b = [2 3 4 1];
g = graph(a,b);
p = plot(g);
axis off

单击例如Visualize按钮,我将在指南图中显示图表。框架。 enter image description here

我尝试在App Designer中执行此操作,并且可以绘制数值,但对于图表可视化,我找不到正确的方法。

methods (Access = private)

    % Button pushed function: VisualizeButton
    function VisualizeButtonPushed(app, event)

        a = [1 2 3 4];
        b = [2 3 4 1];

        g = graph(a,b);
        ax = app.UIAxes;

        plot(ax,g)
    end
end

enter image description here

1 个答案:

答案 0 :(得分:1)

正如我的评论中所述,仅在R2017a 12 中添加了对在应用设计器中绘制graph对象的支持。

除非您想要使用R2016a中提供的绘图功能自己重新实现graph的麻烦(这可能超出了答案的范围),您应该只更新您的MATLAB版本。

相关问题