Using graph theory inside Simulink

2 ビュー (過去 30 日間)
Danny
Danny 2022 年 7 月 1 日
回答済み: Steven Lord 2022 年 7 月 1 日
Hello, I want to use the graph theory inside Simulink to generate C-Code after (https://fr.mathworks.com/help/bioinfo/ug/graph-theory-functions.html), but I am facing these issues :
Graph variables aren’t handle by data dictionaries, but are inside base and model workspace
There is no Simulink block to use directly graphs
In a Matlab function block, I can load a graph from Model Workspace, as data parameter but Simulink won’t handle it :
  • Error : Expression 'myGraph' for initial value of data 'myGraph' must evaluate to logical or supported numeric type.
I used a very simple graph and it has only scalar string types for Variables
  • Edge_Table = table(["1" "2"; "2" "3"], 'VariableNames', {'EndNodes'});
  • myGraph = graph(Edge_Table);
My conclusion is we can’t use graph theory variables and functions and Simulink, the only way to use it it’s to use Matlab with functions or scripts and inside Matlab create graphs and use functions, then convert results in supported data to Simulink (like doubles) and use simin and simout blocks. But after all that, I am not sure we would be able to generate C-Code.
I would like to know if my conclusion is correct or if there are other ways to use graphs in Simulink. Thank you in advance for your help.

採用された回答

Steven Lord
Steven Lord 2022 年 7 月 1 日
Some of the "Graph and Network Algorithms" functions in MATLAB support the C/C++ Code Generation extended capability, as you can see by clicking the check box next to that capability in the left frame of that page. Some of those functions that support C/C++ Code Generation do have limitations or notes about that support, which you can read in the Extended Capabilities sections on their individual documentation pages.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by