필터 지우기
필터 지우기

Extract text data without knowing the size of the data.

조회 수: 1 (최근 30일)
Jacky
Jacky 2013년 6월 7일
Hi, I have the following problems. I have a large amount of data that have similar format as follow. The problems are break into three parts. First part, I need to ignore the 3 headerlines without counting the number of headerlines and store MatlabStart,MatlabBin,MatlabVel and their corresponding data into matix. I have already done that by finding matching in '='. My problem now is how to recognize the data table( the data after MatlabVel) and store the header and its data into a different matrix/array. Again, without specifying the size of the table data. I know textscan can do sth like textscan(fid,%f%f%f%f 'delimiter', ' '). My point is how to let matlab recognize the data table without specifying the %f%f%f%f(e.g is there other way other than textscan?). And finally, how do i let matlab to stop scanning when it reaches the line 'threshold'. Since i do the '=' matching in the first part of the problem, so it is continue to store the remaining data after threshold. Any help or advice or hint will very much be appreciated.
This is just an matlab example\C:version.exe
Version: Matlab13.5
Identity: Default : 3.78
MatlabStart = 10;
MatlabBin = 125;
MatlabVel = 587;
Index Inbox Miscalculate Misinterprete
0 -1 -3000 5000
1 200 -1000 6788
2 500 800 400
Threshold
A
Fence1=100
Fence2=200
Fence3=400
Bet1= 2
Bet2= 3
Bet3= 4
B
Fence1=700
Fence2=150
Fence3=800
Bet1= 2
Bet2= 3
Bet3= 4

채택된 답변

Julius
Julius 2013년 6월 10일
You can try a function called "readtext"

추가 답변 (2개)

Jacky
Jacky 2013년 6월 10일
편집: Jacky 2013년 6월 10일
Should have known this function earlier. I did it the hard way using some codings. Thanks for referring the link. It definitely help me to simplify my code.
  댓글 수: 1
Julius
Julius 2013년 6월 10일
You're welcome. I had exactly the same problem as you one year ago and I spent quite a lot of time searching for solutions.
In my opinion Matlab should include functions of such purposes in its built-in function library.

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


Jacky
Jacky 2013년 6월 10일
thanks

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by