Problem reading a text from a text file?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have problem reading a text from a text file and I got this result as showen in the figure.
I could not get the text inside the text file and this is my code .The code is about importing the file and save it and read it.But the reading is not working.
Could you help me please?
[filename,pathname] = uigetfile({'*.txt'},'File Selector');
app.WordFileEditField.Value = strcat(pathname,filename);
save (filename);
fileID = fopen (filename,"rt");
if fileID < 0
error('error opning file %s/n/n',filename)
end
tline = fgets(fileID);
while ischar (tline)
fprintf('%s',tline)
tline = fgets(fileID);
end
fprintf('/n');
fclose(fileID);
app.UIFigure.Visible = 'off';
app.UIFigure.Visible = 'on';

0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Low-Level File I/O en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!