MATLAB Answers

extract dataset from textfile to many variables

조회 수: 1(최근 30일)
Win co
Win co 2013년 6월 9일
Hi everyone, I have a textfile with N rows of data (N is very big, 45e6 for example). I would like to divide these N rows into k subsets of 1e6 rows (I suppose k is integer to simplify the problem), then save each subset to one file .mat. Could somebody show me how to code please ? Best regards, Winn

채택된 답변

Walter Roberson
Walter Roberson 2013년 6월 9일
If you are using OS-X or Linux, I suggest you use the Unix-level command "split"
On MS Windows, if efficiency is important, I suggest you use perl (which is included with all MATLAB releases.) The perl code can be seen at
To do it in MATLAB, I would probably suggest doing the reading using textscan() with a format of '%s' and 'Delimiter', ''
  댓글 수: 3
Win co
Win co 2013년 6월 10일
It's so great your help. That's exactly what I'm looking for. Thank you very much

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by