📄 switchinput_wrapper.c
字号:
/*
*
* --- THIS FILE GENERATED BY S-FUNCTION BUILDER: 2.0 ---
*
* This file is a wrapper S-function produced by the S-Function
* Builder which only recognizes certain fields. Changes made
* outside these fields will be lost the next time the block is
* used to load, edit, and resave this file. This file will be overwritten
* by the S-function Builder block. If you want to edit this file by hand,
* you must change it only in the area defined as:
*
* %%%-SFUNWIZ_wrapper_XXXXX_Changes_BEGIN
* Your Changes go here
* %%%-SFUNWIZ_wrapper_XXXXXX_Changes_END
*
* For better compatibility with the Real-Time Workshop, the
* "wrapper" S-function technique is used. This is discussed
* in the Real-Time Workshop User's Manual in the Chapter titled,
* "Wrapper S-functions".
*
* Created: Sat Apr 30 13:42:44 2005
*/
/*
* Include Files
*
*/
#if defined(MATLAB_MEX_FILE)
#include "tmwtypes.h"
#include "simstruc_types.h"
#else
#include "rtwtypes.h"
#endif
/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
#include <math.h>
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
#define u_width 1
#define y_width 1
/*
* Create external references here.
*
*/
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
/* extern double func(double a); */
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Output functions
*
*/
void switchinput_Outputs_wrapper(const real_T *index,
const creal_T *signal,
creal_T *y0,
creal_T *y1,
creal_T *y2,
creal_T *y3)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
/* This sample sets the output equal to the input
y0[0] = u0[0];
For complex signals use: y0[0].re = u0[0].re;
y0[0].im = u0[0].im;
y1[0].re = u1[0].re;
y1[0].im = u1[0].im;*/
int_T data_width = ssGetInputPortWidth(S,1) ;
switch ( index )
{
case 1:
{
for ( i = 0; i< data_width ; i ++ )
{
y0[i] = signal[i] ;
}
}
break;
case 2:
{
for ( i = 0 ; i < data_width ; i ++ )
{
y1[i] = signal[i] ;
}
}
break;
case 3:
{
for ( i = 0 ; i < data_width ; i ++ )
{
y2[i] = signal[i] ;
}
}
break;
case 4:
{
for ( i = 0 ; i < data_width ; i ++ )
{
y3[i] = signal[i] ;
}
}
break;
default:
ssSetErrorStatus(S,"the Input0 value error!");
break;
}
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -