Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Read data with non-uniform structure

Subject: Read data with non-uniform structure

From: edward kabanyas

Date: 19 Jul, 2010 09:45:24

Message: 1 of 5

Hi friends !

I want to read the following file (11-30-2006.dat) containing the data with the following structure:

14:27:00 .000 000.000 01** 4843 0065 0058 +26
14:28:00 .000 000.000 01** 4847 0071 0058 +26
14:29:00 R- .033 000.000 01** 4845 0090 0058 +25
14:30:00 R- .555 000.009 01** 4845 0145 0058 +25
14:31:00 R- 1.07 000.027 01** 4849 0197 0058 +25
14:32:00 R- 1.08 000.045 01** 4849 0198 0058 +25
14:33:00 R- .938 000.061 01** 4845 0184 0058 +25
14:34:00 R- .662 000.072 01** 4849 0157 0058 +25
14:35:00 R- .400 000.079 01** 4852 0126 0058 +25

I read with as data = load('11-30-2006.dat'), but it didn't work because the uniform is not uniform.

Do you have any better idea to read the file?

Thanks very much for help.

Regards;
Edward

Subject: Read data with non-uniform structure

From: us

Date: 19 Jul, 2010 10:12:06

Message: 2 of 5

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <i216rk$e2o$1@fred.mathworks.com>...
> Hi friends !
>
> I want to read the following file (11-30-2006.dat) containing the data with the following structure:
>
> 14:27:00 .000 000.000 01** 4843 0065 0058 +26
> 14:28:00 .000 000.000 01** 4847 0071 0058 +26
> 14:29:00 R- .033 000.000 01** 4845 0090 0058 +25
> 14:30:00 R- .555 000.009 01** 4845 0145 0058 +25
> 14:31:00 R- 1.07 000.027 01** 4849 0197 0058 +25
> 14:32:00 R- 1.08 000.045 01** 4849 0198 0058 +25
> 14:33:00 R- .938 000.061 01** 4845 0184 0058 +25
> 14:34:00 R- .662 000.072 01** 4849 0157 0058 +25
> 14:35:00 R- .400 000.079 01** 4852 0126 0058 +25
>
> I read with as data = load('11-30-2006.dat'), but it didn't work because the uniform is not uniform.
>
> Do you have any better idea to read the file?
>
> Thanks very much for help.
>
> Regards;
> Edward

a hint:
- use TEXTREAD or TEXTSCAN to slurp the whole file into a CELLSTRING...
- use string functions, eg, STRFIND, STRCMP, REGEXP, to dissect your data...

us

Subject: Read data with non-uniform structure

From: Wayne King

Date: 19 Jul, 2010 10:24:04

Message: 3 of 5

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <i216rk$e2o$1@fred.mathworks.com>...
> Hi friends !
>
> I want to read the following file (11-30-2006.dat) containing the data with the following structure:
>
> 14:27:00 .000 000.000 01** 4843 0065 0058 +26
> 14:28:00 .000 000.000 01** 4847 0071 0058 +26
> 14:29:00 R- .033 000.000 01** 4845 0090 0058 +25
> 14:30:00 R- .555 000.009 01** 4845 0145 0058 +25
> 14:31:00 R- 1.07 000.027 01** 4849 0197 0058 +25
> 14:32:00 R- 1.08 000.045 01** 4849 0198 0058 +25
> 14:33:00 R- .938 000.061 01** 4845 0184 0058 +25
> 14:34:00 R- .662 000.072 01** 4849 0157 0058 +25
> 14:35:00 R- .400 000.079 01** 4852 0126 0058 +25
>
> I read with as data = load('11-30-2006.dat'), but it didn't work because the uniform is not uniform.
>
> Do you have any better idea to read the file?
>
> Thanks very much for help.
>
> Regards;
> Edward

Hi Edward, one of many possibilities textscan()

>>doc textscan

Wayne

Subject: Read data with non-uniform structure

From: edward kabanyas

Date: 19 Jul, 2010 10:44:05

Message: 4 of 5

Hi Us,

Thanks for your reply.

> > 14:28:00 .000 000.000 01** 4847 0071 0058 +26
> > 14:29:00 R- .033 000.000 01** 4845 0090 0058 +25

However, the column number of the data is not uniform. For example, the first line is without 'R' (only white space), but the the second line with 'R-'..

Regards;
Edward

>use TEXTREAD or TEXTSCAN to slurp the whole file into a CELLSTRING...


"us " <us@neurol.unizh.ch> wrote in message <i218dm$m8p$1@fred.mathworks.com>...
> "edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <i216rk$e2o$1@fred.mathworks.com>...
> > Hi friends !
> >
> > I want to read the following file (11-30-2006.dat) containing the data with the following structure:
> >
> > 14:27:00 .000 000.000 01** 4843 0065 0058 begin_of_the_skype_highlighting              0065 0058      end_of_the_skype_highlighting +26
> > 14:28:00 .000 000.000 01** 4847 0071 0058 +26
> > 14:29:00 R- .033 000.000 01** 4845 0090 0058 +25
> > 14:30:00 R- .555 000.009 01** 4845 0145 0058 +25
> > 14:31:00 R- 1.07 000.027 01** 4849 0197 0058 +25
> > 14:32:00 R- 1.08 000.045 01** 4849 0198 0058 +25
> > 14:33:00 R- .938 000.061 01** 4845 0184 0058 +25
> > 14:34:00 R- .662 000.072 01** 4849 0157 0058 +25
> > 14:35:00 R- .400 000.079 01** 4852 0126 0058 +25
> >
> > I read with as data = load('11-30-2006.dat'), but it didn't work because the uniform is not uniform.
> >
> > Do you have any better idea to read the file?
> >
> > Thanks very much for help.
> >
> > Regards;
> > Edward
>
> a hint:
> - use TEXTREAD or TEXTSCAN to slurp the whole file into a CELLSTRING...
> - use string functions, eg, STRFIND, STRCMP, REGEXP, to dissect your data...
>
> us

Subject: Read data with non-uniform structure

From: us

Date: 19 Jul, 2010 10:55:08

Message: 5 of 5

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <i21a9l$kkt$1@fred.mathworks.com>...
> Hi Us,
>
> Thanks for your reply.
>
> > > 14:28:00 .000 000.000 01** 4847 0071 0058 +26
> > > 14:29:00 R- .033 000.000 01** 4845 0090 0058 +25
>
> However, the column number of the data is not uniform. For example, the first line is without 'R' (only white space), but the the second line with 'R-'..
>
> Regards;
> Edward
>
> >use TEXTREAD or TEXTSCAN to slurp the whole file into a CELLSTRING...

well... that's why i added

- use string functions, eg, STRFIND, STRCMP, REGEXP, to dissect your data...

for an example, look at one of your earlier OPs...

us

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us