我们可以用C语言读取smoking.mat(数据集)吗?

标签 c matlab

我想用 C 语言阅读它的原因是:
我想创建一个 mnrfit.c 文件/函数来替换 mnrfit.m
要查看“smoking.mat”,它位于Matlab的安装目录下:
C:\Program Files\MATLAB\R2013a\help\toolbox\stats\examples"
如果可能的话,请告诉我如何加载名为“吸烟”的数据集(我已经搜索了很多,但找不到方法)?
一旦,我能够在C中读取/加载smoking.mat。我会将数据集保存在链接列表中(自己制作)

最佳答案

有一个 C/C++ 库:

mat.h

这里有它的所有操作。 (包括打开/加载功能)

#include <mat.h>

matClose (C and Fortran)    Close MAT-file
matDeleteVariable (C and Fortran)   Delete named mxArray from MAT-file
MATFile (C and Fortran) Type for a MAT-file
matGetDir (C and Fortran)   Get directory of mxArrays in MAT-file
matGetFp (C)    Get file pointer to MAT-file
matGetNextVariable (C and Fortran)  Read next mxArray from MAT-file
matGetNextVariableInfo (C and Fortran)  Load array header information only
matGetVariable (C and Fortran)  Read mxArray from MAT-files
matGetVariableInfo (C and Fortran)  Load array header information only
matOpen (C and Fortran) Open MAT-file
matPutVariable (C and Fortran)  Write mxArrays to MAT-files
matPutVariableAsGlobal (C and Fortran)

This blog contains good info: Matlab C Library Mat File Operations

关于我们可以用C语言读取smoking.mat(数据集)吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28790620/

相关文章:

python - PyArg_ParseTupleAndKeywords() 中无值 PyObject 为 NULL

windows - Windows 上 Matlab 64 位版本的免费 SCM

matlab - 在 Matlab 中使用数据点和计数向量计算标准差

matlab - 在 TextMate 中运行 Octave

matlab - 在 MATLAB 中为不同矩阵中的每一行应用相交

matlab - 支持向量机参数 matlab

c - 使用 while block 什么也不做是一件坏事吗?

c - 共享内存和memcpy问题

c - 在键盘输入时无限循环停止时执行 - C

c - 如何在C HTTP客户端程序中向文件写入HTTP请求