fread

Read a binary file

Syntax

y = fread ( file_id,precision,additionalstr[=""] )
y = file_id.fread ( precision,additionalstr[=""] )

Inputs

ArgumentTypeDescriptionUnit
file_idfile_idfile identifier from fopenn/a
precisiontextstring of precision; see below-
additionalstrtextadditional text "audio" "a" "audio2" or "a2"-

Outputs / Return Value

Notes

Examples

Open the file generated in examples of <a href="fwrite.html">fwrite</a>, read as int16 into 1) a non-audio object and 2) an audio object:
<p style="padding-left: 30px;">fd=fopen("x.raw","rb")
a=fd.fread("int16")
fd.fclose</p>
<p style="padding-left: 30px;">fd=fopen("x.raw","rb")
b=fd.fread("int16","audio")
fd.fclose</p>
a is a non-audio object with the range between -32768 and 32767; b is an audio object with the range between -1 and 1.
If the raw file represents a stereo audio data, "audio2" should be used as the second arg instead of "audio."

See Also

Review Status