C++解析操作mat文件方法-基于vs2019
前言
工作中需要将C#脚本转为C++,所转脚本主要功能是进行mat数据文件的解析和矩阵运算。
1.C#版本
原C#脚本主要是基于
MathNet.Numerics.data.Matlab、MathNet.Numerics.LineAlgebra.Double、
MathNet.Numerics.LineAlgebra
中的MatlabReader、DenseMatrix、Matrix进行mat文件的读取,矩阵数据的运算和存储。具体例子如下代码所示:
using System;
using System.Collections.Generic;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Data.Matlab;
namespace MatExample
{pulic class MathExample{private Matrix<double> matData; // 17*83private Matrix<double> b; //17*1public MathExample(){Assembly assm = Assembly.GetExecutingAssembly