Problem reading a text from a text file?

3 visualizaciones (últimos 30 días)
Abdullah Alsuhaymi
Abdullah Alsuhaymi el 29 de Mayo de 2019
Editada: Abdullah Alsuhaymi el 29 de Mayo de 2019
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';

Respuestas (0)

Categorías

Más información sobre Low-Level File I/O 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