Thursday 15 May 2014

matlab formatspec (number of digits to load from text file) -


I have a text file up to 16 digits (decimal) and Iam is trying to load iut to use matlab through the following snippet:

  CLC; Clear all; FormatSpec = '% 16.16'; FileID = fopen ('1_1_F', 'r'); F1 = fscanf (fileID, formatSpec);  

So, I would like to load 16 digits + 16 decimal however, the above code fails to load anything in my array F1 when I enter my formatSpec Change only to % f , it works perfectly well, why is it so? I am completely confused with this behavior.

fscanf > Textscan . Here a format % 16.16f does not match your data, the first number specifies the total number of digits, which is not the left of . . You probably want to:

  x = textscan (fileID, '% 32.16f')  

No comments:

Post a Comment