importing text files via importdata

2 visualizaciones (últimos 30 días)
Philip Cung Van Ni Thangngat
Philip Cung Van Ni Thangngat el 24 de Sept. de 2019
Respondida: Athul Prakash el 27 de Sept. de 2019
I have a task saying that I have to upload the two first columns in a text file using the importdata function? Anyone who knows how?

Respuestas (1)

Athul Prakash
Athul Prakash el 27 de Sept. de 2019
Try this: You may use the Import Data Tool to do it graphically. [Click: 'Home' Tab > 'Variable' section > 'Import Data' icon]. In the Import Tool, you may modify the selected area to just the first two columns. Please select the output type too, to Table/ColumnVectors... etc. For full functionality, refer to the doc below:
If you're writing a script to do this, have a look at importdata, textscan, fscanf and similar functions. You may search the documentation for the same.
Alternatively, you may read all columns using importdata and then select out only the first two after that:
myData = importdata('YouFileName.txt');
myData = myData([1 2], :);

Categorías

Más información sobre Large Files and Big Data 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!

Translated by