How to read Value from .txt
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Arun Kumar Singh
il 15 Giu 2020
Commentato: Arun Kumar Singh
il 15 Giu 2020
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/316359/image.jpeg)
6 Commenti
Walter Roberson
il 15 Giu 2020
Modificato: Walter Roberson
il 15 Giu 2020
fopen(), textscan() with headerlines 2, format '%*s%f%f%f', 'collectoutput', true, and count 1 (the count goes immediately after the format and before any other options.) cell2mat() the result of textscan() to get the numeric data. fclose()
Risposta accettata
Walter Roberson
il 15 Giu 2020
filename = 'File.txt';
fid = fopen(filename, 'rt');
GAL = cell2mat(textscan(fid, '%*s%f%f%f', 1, 'headerlines', 2, 'collectoutput', true));
fclose(fid);
Più 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!