how to use Matlab coder to generate C code with a binary tree
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I just want to generate C code where a binary tree is involved. following is the related code, in which I have a structure named "node", which contains members "left" and "right". I want "left" and "right" can also be a "node" structure.
But I always get errors when generating the C code, saying "the Structures don't match". I understand that I need to make sure the new node assigned to left should have the same structure, but don't know how to realize that.
function node=tree()
% initialize the root node
node.val=1;
node.left=struct();
node.right=struct();
% create a new node and assign to left
nkd.val=2;
nkd.left=struct();
nkd.right=struct();
node.left=nkd;
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Simulink PLC Coder en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!