How to read Value from .txt
1 view (last 30 days)
Show older comments
Arun Kumar Singh
on 15 Jun 2020
Commented: Arun Kumar Singh
on 15 Jun 2020

6 Comments
Walter Roberson
on 15 Jun 2020
Edited: Walter Roberson
on 15 Jun 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()
Accepted Answer
Walter Roberson
on 15 Jun 2020
filename = 'File.txt';
fid = fopen(filename, 'rt');
GAL = cell2mat(textscan(fid, '%*s%f%f%f', 1, 'headerlines', 2, 'collectoutput', true));
fclose(fid);
More Answers (0)
See Also
Categories
Find more on Data Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!