struggling with 'graph' function in simulink
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Shemin Sagaria
le 12 Juil 2022
Commenté : Shemin Sagaria
le 13 Juil 2022
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 commentaires
Steven Lord
le 13 Juil 2022
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.
Réponse acceptée
Walter Roberson
le 13 Juil 2022
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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!