How can I import bin file?

13 Ansichten (letzte 30 Tage)
Hamed
Hamed am 17 Jul. 2013
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?

Akzeptierte Antwort

Iain
Iain am 17 Jul. 2013
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 Kommentar
Hamed
Hamed am 17 Jul. 2013
thank you lain. the problem was related to 'r'. It works now.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by