How to edit main.c file obtained through MATLAB coder?

3 views (last 30 days)
Hi,
I am having trouble entering actual values to this main.c file which by default gives a null value for everything. Please help me understand how to edit it.
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* main.c
*
* Code generation for function 'main'
*
*/
/*************************************************************************/
/* This automatically generated example C main file shows how to call */
/* entry-point functions that MATLAB Coder generated. You must customize */
/* this file for your application. Do not modify this file directly. */
/* Instead, make a copy of this file, modify it, and integrate it into */
/* your development environment. */
/* */
/* This file initializes entry-point function arguments to a default */
/* size and value before calling the entry-point functions. It does */
/* not store or use any values returned from the entry-point functions. */
/* If necessary, it does pre-allocate memory for returned values. */
/* You can use this file as a starting point for a main function that */
/* you can deploy in your application. */
/* */
/* After you copy the file, and before you deploy it, you must make the */
/* following changes: */
/* * For variable-size function arguments, change the example sizes to */
/* the sizes that your application requires. */
/* * Change the example values of function arguments to the values that */
/* your application requires. */
/* * If the entry-point functions return values, store these values or */
/* otherwise use them as required by your application. */
/* */
/*************************************************************************/
/* Include files */
#include "rt_nonfinite.h"
#include "FRW.h"
#include "main.h"
#include "FRW_terminate.h"
#include "FRW_initialize.h"
/* Function Declarations */
static void argInit_5x1_real_T(double result[5]);
static double argInit_real_T(void);
static void main_FRW(void);
/* Function Definitions */
static void argInit_5x1_real_T(double result[5])
{
int b_j0;
/* Loop over the array to initialize each element. */
for (b_j0 = 0; b_j0 < 5; b_j0++) {
/* Set the value of the array element.
Change this value to the value that the application requires. */
result[b_j0] = argInit_real_T();
}
}
static double argInit_real_T(void)
{
return 0.0;
}
static void main_FRW(void)
{
double dv0[5];
double Weight;
/* Initialize function 'FRW' input arguments. */
/* Initialize function input argument 'coeff'. */
/* Call the entry-point 'FRW'. */
argInit_5x1_real_T(dv0);
Weight = FRW(argInit_real_T(), argInit_real_T(), argInit_real_T(),
argInit_real_T(), argInit_real_T(), argInit_real_T(), dv0);
}
int main(int argc, const char * const argv[])
{
(void)argc;
(void)argv;
/* Initialize the application.
You do not need to do this more than one time. */
FRW_initialize();
/* Invoke the entry-point functions.
You can call entry-point functions multiple times. */
main_FRW();
/* Terminate the application.
You do not need to do this more than one time. */
FRW_terminate();
return 0;
}
/* End of code generation (main.c) */

Answers (1)

Walter Roberson
Walter Roberson on 31 Aug 2015
That code calculates Weight and then does not do anything further with it.
The code has the routine main(). By convention, routines named main() are intended to be the entry point for the entire program -- that is, when you have main() it is intended that main() is the program, that it might call other routines but that the code is not called by other routines. The code is therefore responsible for displaying or saving any results it wants. If you intend the code to be called by MATLAB and to return a value then you need to generate the code differently.
  3 Comments

Sign in to comment.

Categories

Find more on Deployment Basics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!