필터 지우기
필터 지우기

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 CenterFile Exchange에서 Low-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