Matlab Timestamping

I have a file with a data value and a timestamp that I am trying to split in Matlab. This is the format:

-18.151346    Mon Jan 28 11:33:08 2013

I am using the textscan function to try to break it down.

data=textscan(fid,'%f%s%s%f%s%n','delimiter','space');

I am trying to split the timestamp into separate columns so that I can just use the time, not the date or year. I looked at some previous questions that were very similar, but for some reason I just can't get him to do what I want. My resulting array of cells is in this format.

Column 1     Column 2   Column 3 
-18.151346   Mon       Jan 28 11:33:08 2013

I am completely new to Matlab, so any help would be greatly appreciated. Thanks in advance.

+5
source share
2 answers
  • 'space' , textscan. ' '.
  • , 'MultipleDelimsAsOne' 1.

:

textscan( fid, '%f%s%s%s%s%n', 'delimiter', ' ', 'MultipleDelimsAsOne', 1);

, , :

textscan( fid, '%f%s%s%s%s%n');

, , . , :

-18.151346 28 11:33:08 2013

5- .

+1

, regexp.

, , , , , .

A = regexp(str,'[^\s]+','match');

. , values time 1 5.

:

cell = {'-18.151346 Mon Jan 28 11:33:08 2013','19.33333 Tue Feb 29 10:12:23 2012'};

A{1,2}.

, , .

0

All Articles