Azzera filtri
Azzera filtri

Import text files with extensions other than .txt

27 visualizzazioni (ultimi 30 giorni)
I have a text file shown below. The file has .vasp extension.
When I changed the extension to .txt, the file is opening by entering readtable('filename.txt'), could you please help me open this file without changing extension to .txt ?
Ti4 N4
1.0
4.2535338402 0.0000000000 0.0000000000
0.0000000000 4.2535338402 0.0000000000
0.0000000000 0.0000000000 4.2535338402
N Ti
4 4
Direct
0.000000000 0.000000000 0.500000000
0.500000000 0.000000000 0.000000000
0.000000000 0.500000000 0.000000000
0.500000000 0.500000000 0.500000000
0.000000000 0.000000000 0.000000000
0.000000000 0.500000000 0.500000000
0.500000000 0.000000000 0.500000000
0.500000000 0.500000000 0.000000000

Risposta accettata

Star Strider
Star Strider il 27 Feb 2021
Use detectImportOptions to tell readtable to read the file as a text file.
One recent example from an earlier Answer:
opts = detectImportOptions('breast-cancer-wisconsin.data', 'FileType','text');
BCTable = readtable('breast-cancer-wisconsin.data', opts);
A similar approach should also work for your files.
See Text and Spreadsheet Files in the readtable documentation for more information.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by