[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
wavread problems
From: |
John W. Eaton |
Subject: |
wavread problems |
Date: |
Wed, 11 May 2005 13:08:04 -0400 |
On 11-May-2005, Doug Stewart wrote:
| I have been working at fixing wavread, and I have run into a snag.
|
| I am running Andy Adler's port 2.1.42 and
|
| cygwin with 2.1.50
|
| In 2.1.42 this code works
|
|
| % read riff chunk ChunkID 4 bytes
| RIFF_str=char(fread(fid,4,'uchar'));
| if (strcmp(RIFF_str,'RIFF')==0)
| fclose(fid);
| error(sprintf('%s is not a WAV file',wavefile));
| end
|
| but in 2.1.50 it doesn't
| but this does
|
| % read riff chunk ChunkID 4 bytes
| RIFF_str=char(fread(fid,4,'uchar'));
| if (strcmp(RIFF_str','RIFF')==0)
| fclose(fid);
| error(sprintf('%s is not a WAV file',wavefile));
| end
|
| I had to transpose the RIFF_str for the strcmp to work.
|
| So my question is
| 1 - is this a windows problem?
| 2 - did strcmp change or char change?
| 3 - more importantly what way does the latest version work?
For compatibility, fread returns a column vector, even if the result
is a character string. But you could also write
char (fread (fid, [1, 4], "uchar"))
if you want a row vector.
BTW, you can write
error ("%s is not a WAV file", wavefile);
instead of using sprintf because the error function processes
arguments the same as printf.
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Using C files with OCtave, SITI HAJAR A BAKAR, 2005/05/09
- Re: Using C files with OCtave, Ludovic PĂ©net, 2005/05/09
- Re: Using C files with OCtave, Paul Thomas, 2005/05/09
- Re: wavread problems, Robert A. Macy, 2005/05/11
- Re: wavread problems, Keith Goodman, 2005/05/11
- Re: wavread problems, John W. Eaton, 2005/05/11
- Re: wavread problems, Doug Stewart, 2005/05/11
- Re: wavread problems, Keith Goodman, 2005/05/11
- Error message formatting (was Re: wavread problems), Quentin Spencer, 2005/05/11
- Re: Error message formatting (was Re: wavread problems), Keith Goodman, 2005/05/11
- Re: Error message formatting (was Re: wavread problems), John W. Eaton, 2005/05/12