help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with fopen and fread


From: Bill Denney
Subject: Re: Help with fopen and fread
Date: Sat, 10 Jun 2006 19:31:47 -0400 (EDT)

On Sat, 10 Jun 2006, Glenn Oliver wrote:

Code in question is simple and works in matlab 7.13:
fid = fopen("filename","r","ieee-be");
freport
[samplenum,countsamp] = fread(fid,Inf,"uint32",44,"ieee-be");

and the error returned is this:
error: fread: invalid stream number = -1
error: called from `test_processor:get_incsum_tflp_from_raw' in file
`/octave_files/test_processor.m'
error: called from `test_processor' in file `/octave_files/test_processor.m'

The "invalid stream number = -1" error looks like the actual problem is the fopen line. If fid is -1, there was an error during the fopen command, and you can see what it was by doing something like:

[fid, msg] = fopen("filename","r","ieee-be");
if (fid == -1)
  error ("Unable to open filename: %s", msg)
endif

which should give you more information. (I didn't test this code, I just typed it into the e-mail.)

Bill

--
"You're watching sausage being made in the open. Fun isn't it (but at
least it's educational)."
  -- Jermey Allison, Samba team



reply via email to

[Prev in Thread] Current Thread [Next in Thread]