Hi, I'm using R2016a.
I have a code in m file like the following
a = [1 1 2 2 2 3 5];
b = [2 3 3 4 6 5 6];
bobot = [0.7 3.8 3.7 2.1 1.6 4 1.8];
C = graph(a,b,bobot);
p=plot(C,'EdgeLabel',C.Edges.Weight);
If I run this code in an m file, it will be very easy for me to get a graph plot like the following
then I want to display this in axes in the app designer as shown below
however, I get an error message like the following.
How can I display the graph plot in my app.UIAxes?

 Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 28 Mär. 2021
Bearbeitet: Cris LaPierre am 28 Mär. 2021

0 Stimmen

This may be version-specific issue. Your code works fine in R2021a. I don't have R2016a installed to test. I did test it in R2017a, the oldest version I have installed. It worked.
Do you have the ability to update? If not, perhaps try restarting MATLAB?

5 Kommentare

Ari Ria
Ari Ria am 29 Mär. 2021
so this code is working in 2017a? did you install all of its products when you installed the Matlab product? because I only installed a few products. I also can't update my matlab yet
Are you sure you added app.UIAxes to
p = plot (C, 'EdgeLabel', C.Edges.Weight);
so that
p = plot (app.UIAxes,C, 'EdgeLabel', C.Edges.Weight);
?
Cris LaPierre
Cris LaPierre am 29 Mär. 2021
Thank you for checking. Yes, I'm sure.
You only need MATLAB to run your code, as the plot and graph functions are included in base MATLAB.
I installed R2016a today and confirmed that the code as written will cause an error. The issue appears to be that, in R2016a, uiaxes did not support graphs (your variable C).
The plot command plots into axes while app designer uses uiaxes. They are not the same thing, although each release brings them closer together.
Support for plot(graph) was was added in R2017a (see here). If you want to use app designer, the only soluiton is to update to at least R2017a.
Ari Ria
Ari Ria am 1 Apr. 2021
It work now. I've installed 2021a. But I have new peoblem. Maybe it's just a matter of memory capacity of my PC or maybe some other problem.
loading app.UIAxes doesn't stop like the following image
and I can't edit these UIAxes, can't grab, zoom, etc. including delete, as shown below
I don't know if you have any other ideas regarding this. But I would like to uninstall other products that are not related to this project. Therefore, do you know which product I should maintain? and If you have any other ideas regarding this app.UIAxes please let me know.
Cris LaPierre
Cris LaPierre am 1 Apr. 2021
As I said, you only need MATLAB.
I'm not sure what is happening here. I would suggest contacting customer support.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by