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