How do I read a .txt file ?

1 回表示 (過去 30 日間)
Add
Add 2016 年 3 月 25 日
編集済み: Stephen23 2016 年 3 月 25 日
Hi The .txt file is as such
Name Lon Lat
xxxx 12.111 15.1122
It continues for seven rows. How to read this file using fileID and formatspec ?? I want to read these 3 columns and write into 3 separate data arrays. Please help.

採用された回答

Stephen23
Stephen23 2016 年 3 月 25 日
編集済み: Stephen23 2016 年 3 月 25 日
fid = fopen('filename.txt','rt');
C = textscan(fid,'%s%f%f','headerlines',1);
fclose(fid);
name = C{1};
LatN = C{2};
LonN = C{3};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by