Main Content

C/C++에서 MAT 파일 읽기

예제 파일 matdgns.c에서는 라이브러리 루틴을 사용하여 MAT 파일을 읽고 진단하는 방법을 보여줍니다. 코드를 보려면 MATLAB® 편집기에서 파일을 여십시오.

프로그램을 빌드한 후 애플리케이션을 실행합니다. 이 프로그램은 C 또는 C++에서 MAT 파일 생성하기 예제에서 생성된 MAT 파일 mattest.mat를 읽어 들입니다. 플랫폼에 따라 애플리케이션 아이콘을 더블 클릭하거나 시스템 프롬프트에 matdgns를 입력하여 애플리케이션을 실행하십시오.

matdgns mattest.mat
Reading file mattest.mat...
 
Directory of mattest.mat:
GlobalDouble
LocalString
LocalDouble
 
Examining the header for each variable:
According to its header, array GlobalDouble has 2 dimensions
  and was a global variable when saved
According to its header, array LocalString has 2 dimensions
  and was a local variable when saved
According to its header, array LocalDouble has 2 dimensions
  and was a local variable when saved
 
Reading in the actual array contents:
According to its contents, array GlobalDouble has 2 dimensions
  and was a global variable when saved
According to its contents, array LocalString has 2 dimensions
  and was a local variable when saved
According to its contents, array LocalDouble has 2 dimensions
  and was a local variable when saved
Done

관련 항목