Borrar filtros
Borrar filtros

Can' read low level file

2 visualizaciones (últimos 30 días)
Rooy
Rooy el 14 de Abr. de 2012
% open the file for reading
fp = fopen(filename,'r');
% get off the header line
fgetl(fp);
%get data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% read the data to the specified size
size = fscanf(fp,'%d %f %f %f',[4 inf]);
Mt text file

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Abr. de 2012
You did not indicate the problem you encountered.
I suggest
fp = fopen(filename, 'r');
datacell = textscan(fp, '%d%f%f%f', 'HeaderLines', 1);
fclose(fp);
Then the month number will be datacell{1}, and the other columns will be datacell{2}, datacell{3}, datacell{4}
  1 comentario
Rooy
Rooy el 14 de Abr. de 2012
Thanks for your help, for some reason it did not work yesterday but it works now.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by