User`s guide

Mixing M-Files and C or C++
main_for_lib.c, which contains one main function
main_for_lib.h, which is the header for structures used in
main_for_lib.c and multargp.c
multarg.m
specifies two input parameters and returns two output parameters.
function [a,b] = multarg(x,y)
a=(x+y)*pi;
b = svd(svd(a));
The code in multarg p.c calls m lfMu ltarg and then displays the two values
that
mlfMultarg returns.
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "libMultpkg.h "
/*
* Function prototype; MATLAB Compiler creates mlfMu ltar g
* from multarg.m
*/
void PrintHandler( const char *text )
{
printf(text);
}
int main( ) /* Programmer-written coded to call mlfMultarg */
{
#define ROWS 3
#define COLS 3
mclOutputHandlerFcn PrintHandler;
mxArray *a = NULL, *b = NULL, *x, *y;
double x_pr[ROWS * C OLS] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
double x_pi[ROWS * C OLS] = {9, 2, 3, 4, 5, 6, 7, 8, 1};
double y_pr[ROWS * C OLS] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
double y_pi[ROWS * C OLS] = {2, 9, 3, 4, 5, 6, 7, 1, 8};
double *a_pr, *a_pi, value_of_scalar_b;
6-19