Filter löschen
Filter löschen

Importing non-standard data

2 Ansichten (letzte 30 Tage)
Keith
Keith am 4 Jun. 2012
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???

Antworten (1)

per isakson
per isakson am 4 Jun. 2012
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:
  1. a number with eight digits (positions), %8u
  2. a number with two positions, %2u
  3. a string of letters, %24s
--- 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 Kommentare
Keith
Keith am 4 Jun. 2012
Hi per isakson - thanks for your prompt response. Yes that is how the the file looks.
I appreciate what you are saying - but what code should I use to import the text file into MATLAB? And then how can I create a vector which facilitates chronologically illustrating the data for consecutive hours over consecutive days.Thanks for any assistance you can provide
per isakson
per isakson am 5 Jun. 2012
Now you have three column vectors. Experiment with them.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by