Path: news.mathworks.com!not-for-mail
From: "Muhammad " <irshan_@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help to extract data from string for datetick function
Date: Mon, 6 Jun 2011 07:46:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <isi0js$95o$1@newscl01ah.mathworks.com>
References: <ishtu4$2vu$1@newscl01ah.mathworks.com> <ishvpi$7bf$1@newscl01ah.mathworks.com>
Reply-To: "Muhammad " <irshan_@hotmail.com>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1307346364 9400 172.30.248.35 (6 Jun 2011 07:46:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 6 Jun 2011 07:46:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 891501
Xref: news.mathworks.com comp.soft-sys.matlab:730387

"Muhammad " <irshan_@hotmail.com> wrote in message <ishvpi$7bf$1@newscl01ah.mathworks.com>...
> "Muhammad " <irshan_@hotmail.com> wrote in message <ishtu4$2vu$1@newscl01ah.mathworks.com>...
> > Dear all
> > 
> > I need to extract data from string to use it in datetick function, i have data in the following form
> > 
> > '2009-02-05 07:15:48.545'
> > 
> > I have to make the data compatible with the following format of datetick 
> > 
> > ''yyyy-mm-dd HH:MM:SS' 
> > 
> > so in order to make data compatible with datetick I need to remove  '.545' from the data, please help me in this regard.
> > 
> > Irshan
> 
> I found the solution I have these values in variable T so this code worked fine for doing what i was asking
> 
> position = strfind(T, '.')   %to find position of the dot which was 20
> string = T;
>  %to make new string T1 which contains letter from 1:19 and remove parts after 19
> T1 = {string{1}(1:19)} 
> 
> irshan


This code is only working for one entry of the data series which is string{1}, How can i apply this code for the complete time series.

irshan