⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpleeng.c

📁 MATLAB 7.0从入门到精通,的所有源代码!!!所在类别: 随书资源/T 工业技术/TP 自动化技术、计算机技术/TP31 计算机软件 其他题名: 作者: 求是科技编著 出版者: 人民
💻 C
字号:
/*necessory header file*/
#include "engine.h"
#include "stdio.h"
#include "conio.h"
#define BUFFERLEN 256
/*main function*/
void main()
{
    Engine *ep;
    char cmd[BUFFERLEN];
    int i=0;
    int status=0;
    /*open the engine*/
    ep=engOpen(NULL);
    if(ep==(Engine*)NULL){
    printf("error:can't open MATLAB engine\n");
    exit(-1);
    }
    /*execute MATLAB command*/
    engEvalString(ep,"A=zeros(1,10);");
    /*wait for a moment...*/
    printf("\n please check the outcome in the MATLAB command line!\n");
    printf("\n press any key to continue...\n");
    getch();
    /*execute other MATLAB commands*/
for(i=10;i<20;i++){
    /*the command to be executed in MATLAB*/
    sprintf(cmd,"A(%d)=fibonacci(%d);",i-9,i);
    /*execute the command*/
    engEvalString(ep,cmd);
    }
    /*wait for a moment...*/
    printf("\n please check the outcome in the MATLAB command line!\n");
    printf("\n press any key to continue...\n");
    getch();
    /*close the MATLAB engine and release memory*/
status=engClose(ep);
if(status!=0){
    printf("can't close the engine\n");
    exit(-1);
    }
    printf("\n MATLAB engine is successfully used.\n");
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -