Formatting read data from text files
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Grace
el 4 de Abr. de 2023
Respondida: dpb
el 4 de Abr. de 2023
%I am trying to display the text that is read in a formatted method instead of a single line
%Attached is the test files
clc
clear
Inputfile = fopen('Aarakocra.txt', 'r')
text_data =fscanf(Inputfile, "%s\n")
0 comentarios
Respuesta aceptada
Más respuestas (1)
dpb
el 4 de Abr. de 2023
txt=readlines('YourInputFile.txt'); % read text file as string array
fprintf('%s\n',txt) % dumpt to command window as is
However, if the only purpose is to have the text go across the screen, there's not even any reason to actually read it into memory...
type('YourInputFile.txt'); % echo a text file to command window verbatim
0 comentarios
Ver también
Categorías
Más información sobre Text Files 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!