how to read text file into formatted array
이전 댓글 표시
Hi
I have a text file which contains many rows of this shape
'0862;1;10/09/2002;09:15:59;23.845089;38.018470;486253.80;4207588.10'
I need to read each line in different cells. each cell contains data between ";" and the third and forth one are date and time while others are double numbers.
would you please help me to do so
댓글 수: 2
per isakson
2014년 12월 15일
편집: per isakson
2014년 12월 15일
"I need to read each line in different cells"   Why is that? And what does it exactly mean?
H D
2014년 12월 15일
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2014년 12월 15일
편집: Azzi Abdelmalek
2014년 12월 15일
fid=fopen('FileName.txt')
tline = fgetl(fid)
out=[];
while ischar(tline)
out{end+1,1} =tline
tline= fgetl(fid);
end
fclose(fid)
%You can aadd
A=regexp(out,';','split')
n=numel((A{1}))
B=reshape([A{:}],n,[])'
res=[cell
카테고리
도움말 센터 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!