content of text file exploring, how?

1 Ansicht (letzte 30 Tage)
Nate
Nate am 15 Jul. 2022
Kommentiert: KSSV am 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 Kommentare
Chunru
Chunru am 15 Jul. 2022
Attach your data.
KSSV
KSSV am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by