Probably this has been answered before, but i havent found the answer yet. Im running a code in MATLAB that gives me the amplitude of a certain file that i put as a input, what i tried to do is to run the code for all the files that i had in the folder and make an array of this amplitudes for each file, unfortunately the problem seems to be the fid, since matlab says that for fegtl, i must use an apropiate fid. Here is the part of the code thats causing the trouble:
D=dir('Datos/Banda V-variables/01');
for file=D' %//'
if file.bytes > 1
fid=fopen(file.name,'r');
i=1;
while 1
tline=fgetl(fid); %This is the line where the error appears
if ~ischar(tline), break, end
A{i}=tline;
i=i+1;
end
end
end
At the end i just do a number of calculations of the data and give out a number. A number for each file. Since clearly this method is not working what do yo suggest?, in order to have an array of amplitudes for each file into the folder. Any help would be very much appreciated. Thank you.