Error using feof, Invalid file identifier. Use fopen to generate a valid file identifier.

조회 수: 5 (최근 30일)
fin = fopen('mcs_ansys_standard.txt','rt');
fout = fopen('mcs_ansys.txt','wt');
while ~feof(fin);
str = fgetl(fin);
if strncmp(str,'F,P51X,FY,-',length('F,P51X,FY,-'));
str =strcat('F,P51X,FY,-',num2str(P));
elseif strncmp(str,'MPDATA,EX,1,,',length('MPDATA,EX,1,,'));
str =strcat('MPDATA,EX,1,,',num2str(E));
elseif strncmp(str,'SFBEAM,P51X,1,PRES,',length('SFBEAM,P51X,1,PRES,'));
str =strcat('SFBEAM,P51X,1,PRES,',num2str(W));
end
fprintf(fout, '%s\r\n', str);
end
fclose(fin);
fclose(fout);
!"C:\Program Files\ANSYS Inc\v150\ANSYS\bin\winx64\ansys150.exe" -p ansys -dir "C:\Users\Sirisha\Documents\MATLAB\ranjith" -j "MCS_FEA" -dvt -s read -l en-us -b -i "C:\Users\Sirisha\Documents\MATLAB\ranjith\mcs_ansys.txt" -o "C:\Users\Sirisha\Documents\MATLAB\ranjith\deflecion_out.txt"
fid = fopen('del_max.out','rt');
flag_string = 'NODE UY';
while ~feof(fid);
s = fgets(fid);
flag = strfind(s,flag_string);
if flag
s1 = fgets(fid);
s2 = fgets(fid);
s3 = fgets(fid);
break
end
end
s = str2num(strtrim(s2));
deflection(i) = -s(2);
fclose('all');
end

답변 (1개)

Walter Roberson
Walter Roberson 2016년 3월 25일
mcs_ansys_standard.txt could not be found on the MATLAB path. It either does not exist at all, or is in some directory that is not on the MATLAB path.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by