Problem reading a text from a text file?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Low-Level File I/O in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!