Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Can any one explain that How I can create Matlab command object model in m (as a S function Generator) for given example?

1 visualizzazione (ultimi 30 giorni)
Here, is the one C code, I have manually written S Function code. Now, I need to generate object model for the S Function generator. That object model structure information as below,
The work on the M-file should be modularized (e.g. distributed in smaller, easier parts), like:
1)
reading and analysing the input file (as text, see the M-functions fopen, fread, textscan, and the inputParser class)
- analyse of function call for arguments and argument types (controller function may given as a parameter) and isolating of the text part which belong to the controller function
- analyse of the text of the controller function and founding the variables which are used (for example by using patterns and regular expressions - regexp)
- analyse of the text of the controller function and founding the variables which are defined as local (for example by using patterns and regular expressions - regexp)
- building the list of all variables with their properties (type, data type, if it is pointer or value ...) as a structure for later processing
# separation of variables by type (local, static local, global, function argument, function return value) into individual structures
- finding #includes and building a list of them (they should be included also in the S-Function) ...
At the end of this part the list of objects which are important (input arguments with their types and call method, global variables, additional includes etc.) should be exported in a separate structure which will be used for the creation of the S-Function. Local variables are not important.
/* Header file*/
#ifndef ADD_LIB11_H_INCLUDED
#define ADD_LIB11_H_INCLUDED
double PI_Regler_a(double a,double b, double c, double d, double e, double f);
#endif
/* C file */
#include "add_lib11.h"
double PI_Regler_a(double a,double b, double c, double d, double e, double f)
{
double x;
x = (d*a) + (e*b) + (f*c);
return(x);
}

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by