How can I import bin file?

조회 수: 6 (최근 30일)
Hamed
Hamed 2013년 7월 17일
Hello I am a beginner. I have a binary file and I want to read that and save in a matrix. I tried this code:
FID=fopen('vpt.bin', 'w'); C=fread(FID); fclose(FID); But it just shows the ans=0
I don't know what is the problem?

채택된 답변

Iain
Iain 2013년 7월 17일
You've opened the file for write access.
fid = fopen('vpt.bin','r');
You either need to be sure that "vpt.bin" is in matlab's current directory to read it or you need to include the path, eg, fid = fopen('D:\vpt.bin','r');
  댓글 수: 1
Hamed
Hamed 2013년 7월 17일
thank you lain. the problem was related to 'r'. It works now.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by