User`s guide

C Shared Library Target
if (!libmatrixInitial ize( )){
fprintf(stderr,"could not initialize the library
properly\n");
return -1;
}
/* Create the input data */
in1 = mxCreateDoubleMatrix(3, 3,mxREAL);
in2 = mxCreateDoubleMatrix(3, 3,mxREAL);
memcpy(mxGetPr(in1), data, 9*sizeof(double));
memcpy(mxGetPr(in2), data, 9*sizeof(double));
/* Call the library function */
mlfAddmatrix(1, &out, in1, in2);
/* Display the return value of the library function */
printf("The value of added matrix is:\n");
display(out);
/* Destroy return value since this variable will be reused
in next function call. Since we are going to reuse the
variable, we have to set it to NULL. Refer to MATLAB
Compiler documentation for more informati on on this. */
mxDestroyArray(out); out=0;
mlfMultiplymatrix(1, &out, in1, in2);
printf("The value of the multiplied matrix is:\n");
display(out);
mxDestroyArray(out); out=0;
mlfEigmatrix(1, &out, in1);
printf("The Eigen value of the first matrix is:\n");
display(out);
mxDestroyArray(out); out=0;
/* Call the library termination routine */
libmatrixTerminate();
/* Free the memory created */
mxDestroyArray(in1); in1=0;
mxDestroyArray(in2); in2 = 0;
mclTerminateApplication();
return 0;
}
7-13