Reputation: 2777
My s function is build with SfunctionBuilder block from already existing c source code & tlc file is also generated for it. It takes two nubers as input & output the sum of two numbers.
void add(unsigned char *ip_1,unsigned char *ip_2,unsigned char *result)
{
*result = *ip_1 + *ip_2;
}
I have integrated a matlab s-function in my model.
I am getting following error while generating code, for the model.
Error: Simulink Coder Error in block: "one_mdl_extention/One Model/S-Function Builder", block type "S-Function": Block output output_1 uses custom storage class, level 2 but the compliance level of this block is only 1; use a different block or a different custom storage class, level 1 or lower
How to resolve this error ?
I have made a simple c function & used s-function builder to create s function, now how can i decide it as a level-1 or level-2 s function ?
Upvotes: 0
Views: 544
Reputation: 36720
Short answer: Only use Level 2.
Level 1 S-Function block still exists in Matlab primarily for legacy reasons, Level 2 is a improved version. There is nothing you can implement in a Level 1 S-Function which you can not implement in a Level 2 S-Function. Other way round, there are many features missing in the old Level 1 S-Function.
There is only one case, where Level 1 S-Functions have an advantage over Level 2 S-Functions, in simulation they run faster. Most users never create Models of a complexity, that simulation time really matters.
Upvotes: 1