필터 지우기
필터 지우기

struggling with 'graph' function in simulink

조회 수: 4 (최근 30일)
Shemin Sagaria
Shemin Sagaria 2022년 7월 12일
댓글: Shemin Sagaria 2022년 7월 13일
Hi,
I want to use graph function in simulink matlab function and its showing error. I dont know how else I can perform this,
With Matlab, we can use 'graph' function as follows
s = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8];
t = [2 3 8 1 4 8 1 5 8 2 6 7 3 7 6 4 5 7 4 5 6 1 2 3];
g = graph (s,t)
plot (digraph(s,t))
But I cannot use 'graph' function inside MATLAB_function in simulink (error is attached as image - screenshot 22). The code is shared in screenshot 23. Is there any other alternative for this?. I look forward to get some help from experienced users.
I am using MATLAB 2021a
  댓글 수: 2
Steven Lord
Steven Lord 2022년 7월 13일
Please show the full and exact text of the error message(s) you received when you tried to use a graph object in a MATLAB Function block in Simulink. Also please tell us what release you're using, as it might be possible to do what you want just in a later release than the one you're using, and what functions you're calling on your graph object.
Shemin Sagaria
Shemin Sagaria 2022년 7월 13일
Hi,
I have attched the images of the error and my code. The error is in line 10

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

채택된 답변

Walter Roberson
Walter Roberson 2022년 7월 13일
If you do not need Rapid Acceleration mode, or deployment to hardware, then you can use graph plotting in Simulink. For example,
function y = fcn()
coder.extrinsic('graph')
s = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8];
t = [2 3 8 1 4 8 1 5 8 2 6 7 3 7 6 4 5 7 4 5 6 1 2 3];
g = graph (s,t)
plot (g)
y = 0;
which succeeded for me even in Acceleration mode.
Beyond that point, if you need Rapid Acceleration or deploying to hardware, you run into the general problem that plotting is not supported for those modes except through plotting-specific blocks (such as Scope blocks)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by