How to debug the problem of Error using ==> fscanf invalid size

Status
Not open for further replies.

AILab

Newbie level 5
Joined
Nov 24, 2011
Messages
10
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,358
Currently i am doing the feature extraction using matlab, but i face the problem of error using==>fscanf invalid size, but i check so many times there is nothing wrong the coding part. Anyone have suggestion please?Thanks
 

Currently i am doing the feature extraction using matlab, but i face the problem of error using==>fscanf invalid size, but i check so many times there is nothing wrong the coding part. Anyone have suggestion please?Thanks

If you can post your Code ,it Will be easier to point out the mistake

here is an example that will produce "fscanf invalid Size Error"

Code:
%example 
clc
fidw=fopen('sample_record.txt','W');%Open a sample file to  Write 
rad=[ 1 2 3 4 5 6 7 8 9 10];
uint8(rad);

% for i=1:10
    fprintf(fidw,'%d \n',rad(1,i)); %Write some data 
% end 
    
fclose(fidw); %close File 
fidr=fopen('sample_record.txt','r');%Open File Again to  read

A=fscanf(fidr,'%d',[COLOR="#B22222"][B][inf 1][/B][/COLOR])

status=fclose(fidr);%close Fil

, matlab Warns !
Code:
??? Error using ==> fscanf
Invalid size.

Error in ==> seek_example at 15
A=fscanf(fidr,'%d',[inf 1])[/COLOR]

so check the size specified in the fscanf,it might be wrong .
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…