Read first column from the text file
显示 更早的评论
I have a text file that contains eighty rows with six columns of data values. All I want to do is read a first column of values only. How do I read the column ?
1 个评论
Nuwan Liyanage
2020-3-30
% Assigning the path
path = 'C:\Users\User\abc\'; %abc is your folder which contains the txt file
% Assigning a variable to access the file
fileName = [path,'xyz.txt'];
% Importing all the data from the txt file
fileEntireDataSet = importdata(FileName);
% Assigning the first column only
dataFirstColumn = fileEntireDataSet.data(:,1);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!