Converting text file to array

55 views (last 30 days)
mukesh bisht
mukesh bisht on 27 Mar 2021
Answered: Star Strider on 27 Mar 2021
I want to convert the text file (file attached below) into array of size 4X6. The array should not include the first row (containing characters).
Please help

Answers (1)

Star Strider
Star Strider on 27 Mar 2021
The easiest way, since it retains the column headers for reference:
WallTable = readtable('WallContacts.txt');
To extract one variable:
X = WallTable.X
and so for the others.
To extract the entire ‘WallTable’ contents to an array:
WallData = table2array(WallTable)

Community Treasure Hunt

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

Start Hunting!