skip the headers in a text file and extract the data ?

84 views (last 30 days)
I would like to extract the data only from a text file. the text file has a header which contains some numerical values as shown below?
Matrix detected
Double precision storage used.
Matrix size is 5 x 5
Matrix elements a(m,n)
m: matrix row
n: matrix column
m n value
1 1 -4.741986825761376E+00
2 1 -4.630424392475458E+00
3 1 -4.307409743346405E+00
4 1 -3.804889997051831E+00
5 1 -3.171836516325863E+00
1 2 -4.630424380271435E+00
2 2 -4.741959894978010E+00
3 2 -4.630411248725576E+00
4 2 -4.307409755549543E+00
5 2 -3.804868350860215E+00
1 3 -4.307409755549557E+00
2 3 -4.630411248725565E+00
3 3 -4.741959894978017E+00
4 3 -4.630424380271435E+00
5 3 -4.307397514355404E+00
1 4 -3.804889997051820E+00
2 4 -4.307409743346408E+00
3 4 -4.630424392476307E+00
4 4 -4.741986825762240E+00
5 4 -4.630424392476300E+00
1 5 -3.171836516321907E+00
2 5 -3.804868350853141E+00
3 5 -4.307397514355404E+00
4 5 -4.630424380271435E+00
5 5 -4.741959894978017E+00

Accepted Answer

KSSV
KSSV on 25 Nov 2016
Edited: KSSV on 25 Nov 2016
doc textscan
fid = fopen('your text file') ;
data = textscan(fid,'%f %f %f','HeaderLines',7) ;
data = cell2mat(data)
fclose(fid);
  3 Comments
unme
unme on 9 Feb 2017
Probably its a impedance matrix from the Feko??

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!