フィルターのクリア

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)
  1 件のコメント
Shemin Sagaria
Shemin Sagaria 2022 年 7 月 13 日
Thank you Walter. It worked :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by