content of text file exploring, how?

1 visualización (últimos 30 días)
Nate
Nate el 15 de Jul. de 2022
Comentada: KSSV el 15 de Jul. de 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 comentarios
Chunru
Chunru el 15 de Jul. de 2022
Attach your data.
KSSV
KSSV el 15 de Jul. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by