How can Specific line and column text file can be read in Matlab?
2 次查看(过去 30 天)
显示 更早的评论
Hello!
I want matlab to read the line 4 and column 10 of the attached text file. Kindly guide me how to read the specific line and column?
回答(1 个)
Takumi
2020-7-10
fname = 'sub1.txt';
fid = fopen(fname);
% skip 2 lines
for i=1:2
fgetl(fid);
end
str = fgetl(fid); % get specific line
fclose(fid);
num = extractBetween(str,":"," "); % extract numbers
str2num(cell2mat(num)) % convert
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!