- a number with eight digits (positions), %8u
- a number with two positions, %2u
- a string of letters, %24s
Importing non-standard data
1 回表示 (過去 30 日間)
古いコメントを表示
Can anyone assist me, I have data that I need to import and then process. A sample (10 llines (contained within a text file) is as follows:
69194111 1EFFFFFFDDDDDDDDDFFEEFFDD
69194111 2DDDDEEEDDDDDDDDDEDEDDDDE
69194111 3DDDDDDDDDDDDDDDDEDDDDDDD
69194111 4DDDDDDDDDDDDDDDDDDDDDDDE
69194111 5EEDDDDEEDDCCDDDDDDDDDDDD
69194111 6DDDDDDDDDDDDDDDDDDDDDDDE
69194111 7DEEEEFEFDDCCCDDDDEDEEEEE
69194111 8EEDDDDDDDDDDDDDDDDDDDDDD
69194111 9DDDDDDDDDDDDDDDDDDDDDDDD
6919411110DDDDDDDDDDDDDDDDDDDDDGDD
First of all, I am unsure how to import the data. Secondly, the numeric part of the data is a date with each letter representing an hour in the day. The format can vary with spaces being at different parts of the numeric part of each line of data.
I need to separate the data part and put each letter in a vector form which can represent (chronologically) the record for consecutive hours over consecutive days. Can any one help???
0 件のコメント
回答 (1 件)
per isakson
2012 年 6 月 4 日
Does the file look like this?
69194111 1EFFFFFFDDDDDDDDDFFEEFFDD
69194111 2DDDDEEEDDDDDDDDDEDEDDDDE
69194111 3DDDDDDDDDDDDDDDDEDDDDDDD
69194111 4DDDDDDDDDDDDDDDDDDDDDDDE
69194111 5EEDDDDEEDDCCDDDDDDDDDDDD
69194111 6DDDDDDDDDDDDDDDDDDDDDDDE
69194111 7DEEEEFEFDDCCCDDDDEDEEEEE
69194111 8EEDDDDDDDDDDDDDDDDDDDDDD
69194111 9DDDDDDDDDDDDDDDDDDDDDDDD
6919411110DDDDDDDDDDDDDDDDDDDDDGDD
To me this looks like fixed format:
--- Next step ---
I copy&paste the sample to cssm.txt
fid = fopen( 'cssm.txt', 'r' );
frm = '%8u%2u%24s';
cac = textscan( fid, frm );
fclose( fid );
cac is a cell array. Try
cac{1}, cac{2}, cac{3}
2 件のコメント
参考
カテゴリ
Help Center および File 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!