Dynamically sized outputs / work vectors using the Legacy Code Tool
8 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I am trying to build an s - function using the Legacy Code Tool and I have the following problem:
I work with matrices and I want some of the outputs and work vectors to have a dynamically sized first dimension and a second dimension whose size depends on a parameter or input.
So, I want to do this one: (dynamically sized input u1, parameter p1)
def.OutputFcnSpec = 'void step2(double y1[size(u1,1)][size(u1,2)], double u1[][], int32 p1, int32 size(u1,1), int32 size(u1,2), double work1[size(u1,1)][p1], double y2[size(u1,1)][p1])';
But, the compiler does not allow that and I get the following error: "When specifying input/output/parameter/work dynamically sized, all dimensions must be dynamically sized (dwork 1)"
Does anyone have an idea of how I could do that?
Thank you very much in advance.
Agamemnon
0 个评论
采纳的回答
Kaustubha Govind
2012-3-2
What you're looking to do is output a variable-size signal. Unfortunately, I don't think the Legacy Code Tool can handle generation of S-functions that produce variable-size signals. Perhaps you could generate the S-function for a fixed-signal signal first and then modify it manually to support variable-size signals. See here for an example of an S-function that supports this feature.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!