Problem reading a text from a text file?

3 Ansichten (letzte 30 Tage)
Abdullah Alsuhaymi
Abdullah Alsuhaymi am 29 Mai 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';

Antworten (0)

Kategorien

Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by