Effacer les filtres
Effacer les filtres

fread - each character in new line

7 vues (au cours des 30 derniers jours)
Anke Kügler
Anke Kügler le 24 Juin 2016
Commenté : Anke Kügler le 24 Juin 2016
Hi,
I'm trying to read some information from the header of a wave file (fullname is the file with absolute path) using
fid = fopen(fullname);
fseek(fid,364,'bof');
string=fread(fid,24,'char');
However, each character will be on a new line in the string. I don't know if this is like this in the header or a result of fread. How do it get all the characters to be in one line? I tried to google, but didn't really know what to look for and didn't find anything.
Any help very appreciated. Thanks!

Réponse acceptée

Walter Roberson
Walter Roberson le 24 Juin 2016
When you specify a scalar size for fread() the default is to create an N x 1 vector. You should use
string = fread(fid, [1, 24], 'char');
  1 commentaire
Anke Kügler
Anke Kügler le 24 Juin 2016
Thanks! That makes sense :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Argument Definitions dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by