vc++6.0读写MAT文件

本文介绍如何在VC++6.0环境中使用Matlab API操作MAT数据文件,包括必要的配置步骤及所需的第三方库文件。适用于希望在C++项目中读写MAT文件的开发者。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    这里的MAT文件是指通过matlab save/load命令产生的数据文件。本文目的是在vc++6.0中使用Matlab导出的mat API接口对MAT数据文件经行操作。

    程序源码可以参考帮助文档:External Interface/Importing and Exporting data/Examples of MAT-Files/Create a Mat-File in C

    Matlab帮助文档提供的编译方式如下:

For example, to compile and link the stand-alone MAT application matcreat.c using MSVC Version 7.1 on Windows, first copy the file $MATLAB\extern\examples\eng_mat\matcreat.c
(where $MATLAB is the MATLAB root directory) to a directory that is writeable, and then use the following command to build it: mex -f $MATLAB\bin\win32\mexopts\msvc71engmatopts.bat matcreat.c
    即用mcc编译。并没有提供调试的方法,于是我琢磨着用vc++6编译同样的.c文件。帮助文档:External Interface/Importing and Exporting data/Compiling and Linking MAT-File Programs/Required Files From Third-Party Sources提到了用第三方工具编译时需要的库。最终在baidu和文档的帮助下总结出如下设置,即可在VC++6中编译/调试:

创建工程,对工程进行如下设置:

1>setting-c/c++-PreProcessor:

Additional include dirctories:

%MATLAB%\extern\include


2>setting-Link-Input:

Additional library path:

%MATLAB%\extern\lib\win32\microsoft\msvc60

Object/library modules:

libmat.lib libmx.lib libmex.lib libeng.lib

如此设置,经过编译连接后即可生成可执行程序同时还可以调试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值