资源简介
自己写的一些C#调用MATLAB的例子,自己写的一些C#调用MATLAB的例子自己写的一些C#调用MATLAB的例子自己写的一些C#调用MATLAB的例子

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using MLApp;
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
using Untitled1;
using Untitled2;
using ReadMat;
namespace MATLAB
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)//调用m文件
{
int i = 4;
int j = 6;
//Untitled1class c = new Untitled1class();
Untitled1class c = new Untitled1class();
MWArray result = c.test0((MWArray)i (MWArray)j);
//test((MWArray)i (MWArray)j);
label1.Text = result.ToString();
}
private void button2_Click(object sender EventArgs e)//显示图像
{
Untitled2class st = new Untitled2class();
int m = 1 n = 2;
st.test((MWArray)m (MWArray)n);
}
private void button3_Click(object sender EventArgs e)//存储图像并显示
{
MLApp.MLAppClass tmatlab=new MLApp.MLAppClass();
tmatlab.Visible = 0;
string command1 command2;
command1 = “t=0:0.01:2*pi;y=sin(t);h=figure;plot(ty);“;//matlab脚本命令行
string path=Directory.GetCurrentDirectory();//获取当前路径
path = path + “\\Test1.jpg“;
command2 = @“print(h‘-djpeg‘‘“ + path + “‘)“;
tmatlab.Execute(command1);//执行matlab命令
tmatlab.Execute(command2);
tmatlab.Quit();
tmatlab = null;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = Image.FromFile(path);//读取图像
}
private void button4_Click(object sender EventArgs e)//显示矩阵
{
string[] array = new string[4 2];
array[0 0] = “001“;
array[0 1] = “七虎在线“;
array[1 0] = “002“;
array[1 1] = “七虎“;
array[2 0] = “003“;
array[2 1] = “在线“;
array[3 0] = “004“;
array[3 1] = “电脑“;
dataGridView1.Rows.Clear();
for (int m = 0; m < 4; m++)
{
dataGridView1.Rows.Add(1);
for (int n = 0; n < 2; n++)
{
dataGridView1.Rows[m].Cells[n].Value = array[m n].ToString();
}
}
}
private void button5_Click(object sender EventArgs e)//显示mat 文件
{
string path = Directory.GetCurrentDirectory();
path += “\\haha.mat“;
ReadMatclass c = new ReadMatclass();
MWArray r = c.read_mat(path);//读取结果
MWNumericArray rn = (MWNumericArray)r;//强制转成数据形式,这步不能少
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 179 2011-03-15 12:19 MATLAB\MATLAB\bin\Debug\haha.mat
文件 8704 2011-03-14 22:45 MATLAB\MATLAB\bin\Debug\Interop.MLApp.dll
文件 12800 2011-03-24 16:55 MATLAB\MATLAB\bin\Debug\MATLAB.exe
文件 28160 2011-03-24 16:55 MATLAB\MATLAB\bin\Debug\MATLAB.pdb
文件 14328 2011-03-24 16:59 MATLAB\MATLAB\bin\Debug\MATLAB.vshost.exe
文件 490 2007-07-21 01:33 MATLAB\MATLAB\bin\Debug\MATLAB.vshost.exe.manifest
文件 68782 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat.ctf
文件 9216 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat.dll
文件 614 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\ReadMat\read_mat.m
文件 541 2011-03-15 12:25 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\ReadMat_17C22DBD94A698047AC1366220D24E1F\matlab.prf
文件 40 2011-03-12 19:31 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\ReadMat_17C22DBD94A698047AC1366220D24E1F\MLintDefaultSettings.txt
文件 0 2011-03-15 12:28 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\ReadMat_17C22DBD94A698047AC1366220D24E1F\MLintFailureFiles
文件 3199 2011-03-15 12:32 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\ReadMat_17C22DBD94A698047AC1366220D24E1F\WebRenderer\pluginreg.dat
文件 53 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\Contents.m
文件 824 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\ctfroot.m
文件 3104 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\deployprint.m
文件 7168 2008-02-10 03:14 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\deploywhich.mexw32
文件 644 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\deploywhich_mexw32.auth
文件 10195 2006-05-27 14:02 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\FigureMenuBar.fig
文件 6944 2005-11-30 22:10 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\FigureToolBar.fig
文件 749 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\fopen.m
文件 869 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\input.m
文件 779 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\pause.m
文件 959 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\printdlg.m
文件 689 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\propedit.m
文件 9216 2008-02-10 03:14 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\readline.mexw32
文件 644 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\compiler\deploy\readline_mexw32.auth
文件 55 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\local\Contents.m
文件 1514 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\local\hgrc.m
文件 929 2011-03-15 12:38 MATLAB\MATLAB\bin\Debug\ReadMat_mcr\toolbox\local\initprefs.m
............此处省略162个文件信息
相关资源
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
评论
共有 条评论