Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How do it store a particularText file into an array ?

1 visualización (últimos 30 días)
sachin narain
sachin narain el 15 de Abr. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have a Text file (attached along with the question).You can see there are lot of lines at the moment (there can be more) .i want to convert this text file to an array so that the array contains the lines row by row .
I know 'textscan' works but what exactly should my input arguments be so that i get the required result .
Thank you in advance

Respuestas (1)

Bob Thompson
Bob Thompson el 15 de Abr. de 2019
I would suggest loading the file and then splitting.
string = readfile('TestLists.txt');
lines = regexp(string,'\n','split');
  3 comentarios
sachin narain
sachin narain el 16 de Abr. de 2019
I want to convert these lines into row by row data so that i can work on them later as an array
Bob Thompson
Bob Thompson el 16 de Abr. de 2019
readfile is a custom created function. If you would prefer not to use a file of the file exchange then feel free to utilize fileread, importfile, or textscan (use '%s' as the format).
Using the split option with regexp will produce a cell array where each element contains one line of the file.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by