Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: extracting data from long message

Subject: extracting data from long message

From: Bill Jordan

Date: 02 Aug, 2007 19:29:03

Message: 1 of 8

Hello,

I have a long message, I want to extract data groups from
this messsage and save each one separately. Foe example,

MSG= ('12.34 05/06/06 : computer-group: network-groups')

Not the separation beween each group is : . I need to
store each grop separately in other messages or arrays!

can anybdoy tell me how to do thi sim Matlab please?

Thanks

Subject: Re: extracting data from long message

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 02 Aug, 2007 20:34:00

Message: 2 of 8

In article <f8tb9v$mmp$1@fred.mathworks.com>,
Bill Jordan <billulster@mathworks.com> wrote:

>I have a long message, I want to extract data groups from
>this messsage and save each one separately. Foe example,

>MSG= ('12.34 05/06/06 : computer-group: network-groups')

>Not the separation beween each group is : . I need to
>store each grop separately in other messages or arrays!

submessages = textscan(MSG, '%s', 'Delimeter', ':')
--
  There are some ideas so wrong that only a very intelligent person
  could believe in them. -- George Orwell

Subject: Re: extracting data from long message

From: Bill Jordan

Date: 02 Aug, 2007 20:55:01

Message: 3 of 8

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <f8tf3o$huk$1@canopus.cc.umanitoba.ca>...
> In article <f8tb9v$mmp$1@fred.mathworks.com>,
> Bill Jordan <billulster@mathworks.com> wrote:
>
> >I have a long message, I want to extract data groups
from
> >this messsage and save each one separately. Foe example,
>
> >MSG= ('12.34 05/06/06 : computer-group: network-groups')
>
> >Not the separation beween each group is : . I need to
> >store each grop separately in other messages or arrays!
>
> submessages = textscan(MSG, '%s', 'Delimeter', ':')
> --
> There are some ideas so wrong that only a very
intelligent person
> could believe in them. --
George Orwell


Hi walter,

I get the message "??? Error using ==> textscan
First input must be of type double."

I am using Matlab 7.

Thanks

Subject: Re: extracting data from long message

From: Bill Jordan

Date: 02 Aug, 2007 20:55:22

Message: 4 of 8

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <f8tf3o$huk$1@canopus.cc.umanitoba.ca>...
> In article <f8tb9v$mmp$1@fred.mathworks.com>,
> Bill Jordan <billulster@mathworks.com> wrote:
>
> >I have a long message, I want to extract data groups
from
> >this messsage and save each one separately. Foe example,
>
> >MSG= ('12.34 05/06/06 : computer-group: network-groups')
>
> >Not the separation beween each group is : . I need to
> >store each grop separately in other messages or arrays!
>
> submessages = textscan(MSG, '%s', 'Delimeter', ':')
> --
> There are some ideas so wrong that only a very
intelligent person
> could believe in them. --
George Orwell

Subject: Re: extracting data from long message

From: us

Date: 02 Aug, 2007 21:05:29

Message: 5 of 8

Bill Jordan:
<SNIP down to typo...

> > submessages = textscan(MSG, '%s', 'Delimeter', ':')
> I get the message "??? Error using ==> textscan
> First input must be of type double."...

because, this should have read

     msg='12.34 05/06/06 : cg: ng';
     sm=textscan(msg,'%s','Delimiter',':'); % <- typo
     sm{:}
% ans =
% '12.34 05/06/06 '
% 'cg'
% 'ng'

us

Subject: Re: extracting data from long message

From: Bill Jordan

Date: 02 Aug, 2007 21:17:04

Message: 6 of 8

"us " <us@neurol.unizh.ch> wrote in message
<f8tguo$cs$1@fred.mathworks.com>...
> Bill Jordan:
> <SNIP down to typo...
>
> > > submessages = textscan(MSG, '%s', 'Delimeter', ':')
> > I get the message "??? Error using ==> textscan
> > First input must be of type double."...
>
> because, this should have read
>
> msg='12.34 05/06/06 : cg: ng';
> sm=textscan(msg,'%s','Delimiter',':'); % <- typo
> sm{:}
> % ans =
> % '12.34 05/06/06 '
> % 'cg'
> % 'ng'
>
> us

Stil getting the same error:"??? Error using ==> textscan
> > First input must be of type double.".....

I am using matlab 7.0, anything to do with this version?
Thanks again

Subject: Re: extracting data from long message

From: us

Date: 02 Aug, 2007 21:26:23

Message: 7 of 8

Bill Jordan:
<SNIP potential incompatibility...

> Stil getting the same error:"??? Error using ==> textscan
> > > First input must be of type double"...

try

     msg='12.34 05/06/06 : cg: ng';
     sm=strread(msg,'%s','delimiter',':');
     sm
% sm =
% '12.34 05/06/06 '
% 'cg'
% 'ng'

us

Subject: Re: extracting data from long message

From: Bill Jordan

Date: 02 Aug, 2007 21:36:43

Message: 8 of 8

"us " <us@neurol.unizh.ch> wrote in message
<f8ti5v$2gi$1@fred.mathworks.com>...
> Bill Jordan:
> <SNIP potential incompatibility...
>
> > Stil getting the same error:"??? Error using ==>
textscan
> > > > First input must be of type double"...
>
> try
>
> msg='12.34 05/06/06 : cg: ng';
> sm=strread(msg,'%s','delimiter',':');
> sm
> % sm =
> % '12.34 05/06/06 '
> % 'cg'
> % 'ng'
>
> us

Great!thanks

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
strread us 02 Aug, 2007 17:46:52
syntax us 02 Aug, 2007 17:12:26
code us 02 Aug, 2007 17:12:19
textscan us 02 Aug, 2007 17:12:19
parsing Bill Jordan 02 Aug, 2007 15:30:24
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics