Clear Filters
Clear Filters

How can I import a column of numbers in a text file into a Matrix

4 views (last 30 days)
56.02 0.000123 432.342
56.91 0.00434 452.4324
Import into a Matrix containing both 56 values, different matrix containing the 0.00.. values and a third matrix containing the 432.. values

Answers (1)

Voss
Voss on 17 Feb 2022
Use load() or readmatrix() to read the file, then indexing to separate it into three matrices:
% replace file.txt with your file's name
M = load('file.txt');
A = M(:,1);
B = M(:,2);
C = M(:,3);

Community Treasure Hunt

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

Start Hunting!