Matlab vs C#
来源:互联网 发布:网站排名优化查询 编辑:程序博客网 时间:2024/05/29 12:46
Matlab vs C#
注意:空项目创建 C# project时,必须将所需 cs 文件 -> 添加 -> 解决方案 之中
否则会报错: “ 不包含适合于入口点的静态“Main”方法 ”
C#与MATLAB互联互通 参考 Mathwork 文档
要添加 matlab 引用
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace CSharpMatlabTest1{ public partial class Form1 : Form { private MLApp.MLApp matlab; public Form1() { InitializeComponent(); matlab = new MLApp.MLApp(); } private void btnStart_Click(object sender, EventArgs e) { //显示正弦图 //最小化matlab命令窗口 matlab.MinimizeCommandWindow(); string strMatLab = "t=2:0.2:4*pi;y=sin(t);plot(t,y)"; //最小化matlab命令窗口 matlab.Execute(strMatLab); //生成一个JPG的图形c:\Test1.jpg matlab.Execute("print( gcf, '-djpeg', 'c:\\Test1')"); //退出matlab,释放资源 matlab.Quit(); //显示在图片框 sizeMode 选择为 stretchImage picMatlab.Image = new Bitmap("c:\\Test1.jpg"); } private void btnPie_Click(object sender, EventArgs e) { //饼图 string strMatLab = "sale=[100 400 150 250 500];pie3(sale,[0 0 1 0 0],{'公司A','公司B','公司C','公司D','公司E'})" ; matlab.Execute(strMatLab); } private void btnHelix_Click(object sender, EventArgs e) { //三维螺旋线图 string strMatLab = "t=0:0.2:4*pi;plot3(sin(t),cos(t),t)" ; matlab.Execute(strMatLab); } private void btnWave_Click(object sender, EventArgs e) { //立体波浪图 string strMatLab = "[X,Y,Z] = peaks(20);surfc(X,Y,Z);colormap hsv;axis ([-2 4 -6 8 -10 6])" ; matlab.Execute(strMatLab); } }}
0 0
- Matlab vs C#
- vS+matlab
- MATLAB Compiler VS MATLAB Coder
- vs和MATLAB调用
- VS调用matlab
- matlab vs python
- MATLAB RTW与VS
- Matlab/VS调试
- C# matlab
- C# matlab
- MATALAB 和 VS联合编程<二>matlab脚本和C#的实现
- Matlab 与 vs 混合编程
- bsxfun vs. repmat in Matlab
- matlab 与VS 混合编程
- 【高性能】Eigen VS Matlab
- VS调用Matlab计算引擎
- MATLAB和VS混合编程
- VS下调用Matlab引擎
- C# - 值类型与引用类型
- Java 类的热替换 —— 概念、设计与实现
- 印度是如何做软件开发的
- Android跑马灯效果实现
- 汉字转化为拼音
- Matlab vs C#
- 树总结之并查集趣解
- Android 双侧侧滑菜单(主界面和菜单都会滑动)
- 联合体在单片机中的应用
- magento修改订单状态、添加订单备注代码示例
- system/build.prop参数说明
- C++ - 堆与栈
- Linux 管道
- 整数划分(四)