- #1
justinplume
- 2
- 0
i use fgets to get the number of lines in my file to get rid of the header, but when i do this i can't us fscanf to get the actual data, but it doesn't work any more. Tips and suggestions? Before i entered number of lines in the file. This is how it currently stands:
cldden = fopen(filename, 'r');
%fseek(cldden, 311, 'bof');
nLines = 0;
while (fgets(cldden) ~= -1),
nLines = nLines + 1;
end
length_of_data = nLines-7;
CLD_data_matrix_temp = fscanf(cldden, '%lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg', [11,length_of_data]);
fclose(cldden);
cldden = fopen(filename, 'r');
%fseek(cldden, 311, 'bof');
nLines = 0;
while (fgets(cldden) ~= -1),
nLines = nLines + 1;
end
length_of_data = nLines-7;
CLD_data_matrix_temp = fscanf(cldden, '%lg %lg %lg %lg %lg %lg %lg %lg %lg %lg %lg', [11,length_of_data]);
fclose(cldden);