Load .txt file into matrix form

I am trying to use load syntax to load this txt file into matlab matrix (nX6)

1 Comment

X = load('X_deg_10.txt')
X = 302×7
1.0e+06 * 0 6.7800 0.1000 0.2000 -0.0001 0.0081 -0.0002 0 6.7800 0.1000 0.2000 -0.0001 0.0081 -0.0002 0.0000 6.7756 0.2810 0.1955 -0.0003 0.0081 -0.0002 0.0000 6.7669 0.4619 0.1908 -0.0005 0.0081 -0.0002 0.0001 6.7538 0.6424 0.1860 -0.0007 0.0081 -0.0002 0.0001 6.7365 0.8226 0.1811 -0.0009 0.0080 -0.0002 0.0001 6.7148 1.0022 0.1761 -0.0011 0.0080 -0.0002 0.0001 6.6889 1.1812 0.1710 -0.0013 0.0080 -0.0002 0.0002 6.6587 1.3594 0.1657 -0.0014 0.0080 -0.0002 0.0002 6.6243 1.5368 0.1604 -0.0016 0.0079 -0.0002

Sign in to comment.

 Accepted Answer

That looks like a good candidate for readmatrix.
mtx = readmatrix('X_deg_10.txt');
size(mtx)
ans = 1×2
302 7

2 Comments

This worked! Thanks!
You are quite welcome.

Sign in to comment.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Release

R2022b

Community Treasure Hunt

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

Start Hunting!