how to get multiple output in legacy code tool
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sri prakash muniyandi
el 20 de Oct. de 2014
Respondida: abouessire ismail
el 27 de Mzo. de 2019
Hai, Am try to achieve multiple output from LCT. I have written a .c and .h files as bellow
assign.c
#include “assign.h” Int assign(int In_1, int In_2, int In_3) { Int *Out_1, *Out_2, *Out_3; *Out_1 = In_1; *Out_2= In_2; *Out_3= In_3; }
assign.h
#ifdef ASSIGN_H #define ASSIGN_H Int assign(int In_1, int In_2, int In_3); #endif
And my legacy code is look like
def = legacy_code('intialize'); def.SFunctionName = 'sfun_addnum'; def.HeaderFile = { assign.h'}; def.SourceFile = { assign.c'}; def.OutputFcnSpec = ‘assign(int16 u1, int16 u2, int16 u3, int16 y1[1], int16 y2[1], int16 y3[1])’; legacy_code('sfcn_cmex_generater,def'); legacy_code('compile',def); legacy_code('slblock_generate',def);
Out of this codes I can able to generate a SFunction.c and Sfunction block also. But when I try to simulate the matlab get crashed. Please if any one knows the reason please share with me and also if you have an idea about how to get multiple output variables in LCT by using single c function return.
0 comentarios
Respuestas (1)
abouessire ismail
el 27 de Mzo. de 2019
Hi I hope that you get a solution for your problem .
if not yet the solution is :
assign.c
#include “assign.h”
Int assign(int In_1, int In_2, int In_3,Int *Out_1, int *Out_2,int *Out_3)
{
*Out_1 = In_1; *Out_2= In_2; *Out_3= In_3;
}
that's it .
Hope that tis will work for you ;) .
0 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!