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:(adsbygoogle = window.adsbygoogle || []).push({});

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);

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab fscanf and fgets

Loading...

Similar Threads - Matlab fscanf fgets | Date |
---|---|

Matlab Coding angular spectrum of waves in fluid | 40 minutes ago |

How to program this in Matlab | Feb 28, 2018 |

Matlab Making a short test for self-adjointness | Feb 23, 2018 |

Matlab help, fscanf | Nov 13, 2006 |

**Physics Forums - The Fusion of Science and Community**