0

UIAxes in Matlab App designer does not support non-numeric data such as a graph plot, is there any alternative to do it inside UI framework?

In GUIDE I do this:

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

Clicking for example Visualize button I'll have the graph appeared in the guide fig. framework. enter image description here

I try to do that in App Designer and it's ok for plotting numeric values, but for a graph visualization I didn't find the right way to do so.

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

4
  • Which MATLAB version is this? The App Designer is one of the modules that constantly receives attention in MATLAB releases. Unfortunately for us users, its functionality is still limited with respect to "regular" figures. One of the solutions would be to update your MATLAB version, in hopes that the desired functionality was added at later releases. Regardless, please provide a minimal reproducible example so we can reproduce your error. Commented Mar 13, 2017 at 12:37
  • This is 2016a, academic use. You are right that the App Designer is a very interesting module but I'm a beginner and naturally I expect similar functionality of Guide. I'll update my question explaining what I used to do in Guide. Commented Mar 13, 2017 at 19:57
  • 1
    Note that plot(graph) support was only added in R2017a. Commented Mar 13, 2017 at 21:32
  • I see, actually this is what I was trying to understand, Thanks. Commented Mar 13, 2017 at 23:00

1 Answer 1

1

As mentioned in my comment, support for plotting graph objects in the app designer was only added in R2017a1, 2.

Unless you want to go through the trouble of re-implementing graph yourself using plotting functions available in R2016a (this is probably WAY beyond the scope of an answer), you should just update your MATLAB version.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.