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

조회 수: 1 (최근 30일)
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));

채택된 답변

Walter Roberson
Walter Roberson 2024년 3월 17일
편집: Walter Roberson 2024년 3월 17일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by