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?

 채택된 답변

Cris LaPierre
Cris LaPierre 2021년 3월 28일
편집: Cris LaPierre 2021년 3월 28일

0 개 추천

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

Ari Ria
Ari Ria 2021년 3월 29일
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 2021년 3월 29일
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 2021년 4월 1일
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 2021년 4월 1일
As I said, you only need MATLAB.
I'm not sure what is happening here. I would suggest contacting customer support.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2016a

질문:

2021년 3월 28일

댓글:

2021년 4월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by