emily
emily

Reputation: 11

fread error? invalid file identifier

while executing, I have this error ?? Error using ==> fread Invalid file identifier. Use fopen to generate a valid file identifier. fid is equal to -1 but the file does exist. what shall I do?

seq=dir('C:\Windows\system32\config\systemprofile\Desktop\pfe\code final version 1\nor\info');
N=[];
for i = 3 : length(seq)
disp(seq(i).name)
cd 'C:\Windows\system32\config\systemprofile\Desktop\pfe\code final version 1\nor\info'
fin = fopen('seq(i).name','r');
[x,count]=fread(fin,'char=>char');
cd 'C:\Windows\system32\config\systemprofile\Desktop\pfe\code final version 1'
M=fichier(fin,x);
N=[N;M];
end
xlswrite('info.xls',N);

Upvotes: 0

Views: 191

Answers (1)

Daniel
Daniel

Reputation: 36710

As you put '' around the name, you are trying to open a file called seq(i).name, remove the '' and you are using the variable named seq(i).name

fin = fopen(seq(i).name,'r');

Upvotes: 1

Related Questions