필터 지우기
필터 지우기

How to open a mat file in C?

조회 수: 5 (최근 30일)
HF
HF 2021년 2월 16일
댓글: Walter Roberson 2021년 2월 19일
Hello, I am trying to open a mat file in C. My matfile contains only a matrix called "X(1,1:1024)".
I found the following code to open a mat file in C:
#include "mat.h"
MATFile *matOpen(const char *filename, const char *mode);
However, I am not able to find the file "mat.h" in the internet. Is there another way to load the data into the C program?
Thank you in advance!
  댓글 수: 2
James Tursa
James Tursa 2021년 2월 16일
mat.h and the library that contains the matOpen function ship with MATLAB. Do you have MATLAB installed?
HF
HF 2021년 2월 16일
Yes, I have installed Matlab. I only found a header file called "math.h"

댓글을 달려면 로그인하십시오.

답변 (1개)

Aditya Patil
Aditya Patil 2021년 2월 19일
The file is included with MATLAB installation. You might have to add it to the path where your compiler looks for header files.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 2월 19일
In particular it is in the MATLAB installation directory as extern/include/mat.h
On my system, if I were using a command line compiler, that would involve adding the option
-I/Applications/MATLAB_R2020b.app/extern/include
The -I option for (most) compilers names a top-level directory to look in to resolve #include statements.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by