필터 지우기
필터 지우기

how to get multiple output in legacy code tool

조회 수: 7 (최근 30일)
sri prakash muniyandi
sri prakash muniyandi 2014년 10월 20일
답변: abouessire ismail 2019년 3월 27일
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.

답변 (1개)

abouessire ismail
abouessire ismail 2019년 3월 27일
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 ;) .

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by