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:32:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <ishvpi$7bf$1@newscl01ah.mathworks.com>
References: <ishtu4$2vu$1@newscl01ah.mathworks.com>
Reply-To: "Muhammad " <irshan_@hotmail.com>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1307345522 7535 172.30.248.48 (6 Jun 2011 07:32:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 6 Jun 2011 07:32:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 891501
Xref: news.mathworks.com comp.soft-sys.matlab:730386

"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