?? mysvd.c
字號(hào):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "matlab.h"
static double data[] = { 21, 3, 15, 57, 12, 83, 6, 90 };
void mysvd()
{
/* Initialize pointers to array arguments */
mxArray *X = NULL;
mxArray *U = NULL, *S = NULL, *V = NULL;
mlfEnterNewContext(0, 0);
mlfAssign(&X, mlfDoubleMatrix(4, 2, data, NULL));
/* Compute the singular value decomposition and print it */
mlfAssign(&S, mlfSvd(NULL, NULL, X, NULL));
mlfPrintf("One input, one output:\n");
mlfPrintf("S = \n"); mlfPrintMatrix(S);
/* Multiple output arguments */
mlfAssign(&U, mlfSvd(&S, &V, X, NULL));
mlfPrintf("One input, three outputs:\n");
mlfPrintf("U = \n"); mlfPrintMatrix(U);
mlfPrintf("S = \n"); mlfPrintMatrix(S);
mlfPrintf("V = \n"); mlfPrintMatrix(V);
/* Multiple input and output arguments */
mlfAssign(&U, mlfSvd(&S, &V, X, mlfScalar(0.0)));
mlfPrintf("Two inputs, three outputs:\n");
mlfPrintf("U = \n"); mlfPrintMatrix(U);
mlfPrintf("S = \n"); mlfPrintMatrix(S);
mlfPrintf("V = \n"); mlfPrintMatrix(V);
mxDestroyArray(X);
mxDestroyArray(U);
mxDestroyArray(S);
mxDestroyArray(V);
mlfRestorePreviousContext(0, 0);
return(EXIT_SUCCESS);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -