Error using Fseek. Invalid filer identifier, use fopen to generate a valid file identifier.

1 view (last 30 days)
I get an error stating "Invalid file identifier. Use fopen to generate a valid file identifier."
Folders are 45meas.fid, 55meas.fid, 65meas.fid, etc. (temps+meas)
center_ppm = 5.8;
region_bounds_ppm = [2.924, 2.237];
temps = [45, 55, 65, 75, 85, 95, 100, 105, 110, 115]; %If you have any different temperatures for any reason adjust here
%% Read in and process NMR Data
for ii = 1:length (temps)
file_temp = fopen(strcat(num2str(temps(ii)),'C.fid/fid'));
fseek(file_temp,60,0);
temp_data1 = fread(file_temp,'single','ieee-be');
temp_data3 = complex(temp_data1(1:2:end-1),temp_data1(2:2:end));

Accepted Answer

Walter Roberson
Walter Roberson on 17 Mar 2024
Edited: Walter Roberson on 17 Mar 2024
You attempt to open 45C.fid/fid but 45C.fid does not exist as a folder -- existing folder is 45temps.fid and 45meas.fid
You should be doing
filename = strcat(num2str(temps(ii)),'meas.fid/fid');
[file_temp, msg] = fopen(filename);
if file_temp < 0
warning('failed to open %s because %s', filename, msg);
continue
end

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!