ex1.cpp

来自「c++ 调用matlab的程序 c 调用matlab的程序例子」· C++ 代码 · 共 37 行

CPP
37
字号
/* $Revision: 1.5 $ */// Copyright (c) 1995-1999 The MathWorks, Inc. All Rights Reserved.//// ex1.cpp//// Creating Arrays and Array I/O#include "matlab.hpp"#include <stdlib.h>     /* used for EXIT_SUCCESS */#ifdef GCC #ifndef EXIT_SUCCESS  #define EXIT_SUCCESS 0 #endif#endifstatic double data[] = { 1, 2, 3, 4, 5, 6 };int main(void){  // create two matrices  mwArray mat0(2, 3, data);  mwArray mat1(3, 2, data);		  // print the matrices  cout << mat0 << endl;  cout << mat1 << endl;  // read the matrix from standard in, the print it to standard out  cout << "Please enter a matrix: " << endl;  cin >> mat1;  cout << mat1 << endl;  return(EXIT_SUCCESS);}

⌨️ 快捷键说明

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