content of text file exploring, how?

1 view (last 30 days)
Nate
Nate on 15 Jul 2022
Commented: KSSV on 15 Jul 2022
FileName='Q4.txt';
fileID=fopen(FileName);
CellOutput=[]
Delimiter=','
while feof(fileID)~=1;
a=fgetl(fileID);
a=strsplit(a,Delimiter);
for count=1:1:length(a);
Temp=str2num(a{count});
if ~isempty(Temp);
a{count}=Temp;
end
end
CellOutput=[CellOutput;a]
end
fclose(fileID);
TextOrNum=[]; %This line can be deleted after you are done coding this function.
%%Start your code for this function after this line:
TextToCheck = importdata('Q4.txt')
Numeric= TextToCheck.data
TextToCheck.textdata(2:end,3:end)=num2cell(Numeric)
TextOrNum= TextToCheck.textdata
for i= 1:length(TextOrNum)-1
Fmax{i}=max(Numeric(i,:))
end
Material= TextOrNum(2:end,2)
MaterialxFmax=[Material,Fmax']
SaF=[]
for j=1:length(Properties)
same=ismember(MaterialxFmax(:,1),Properties(j,1));
if same==1;
SaF=(MaterialxFmax(j,2)/Properties(j,2))
end
end
why is this code not running?
  3 Comments
KSSV
KSSV on 15 Jul 2022
It may not be running becuase, the text file is not in the prest working directory. Check the value of fileID.
If not, is it throwing any error? You have to specify the error.

Sign in to comment.

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!