file store different type of data

hi,
is there way by which can store different type of data such as:
ex. 234,'2005-07-21' 165 ,'2006-08-21'
I want avoid use datnum , because it is slow the running if I have huge data
thanks

답변 (1개)

the cyclist
the cyclist 2012년 1월 12일

0 개 추천

Two things you should know:
  1. You can store mixed data types in a cell array: You might start with "doc cell" to get you started looking at the documentation.
  2. The datenum() function is much, MUCH faster if you use the second input argument, in which you specify the format of the strings that are going in.

댓글 수: 2

huda nawaf
huda nawaf 2012년 1월 12일
thanks,
I used
datenum({'2005-09-06'},'yyyy-MM-dd');
do u mean that?
if so, even in this case, the datenum take long time
the cyclist
the cyclist 2012년 1월 12일
Yes. Try this test:
d = repmat({'2005-09-06'},[100000 1]);
tic;
dn1=datenum(d); % about 23s on my machine
toc
tic;
dn2=datenum(d,'yyyy-mm-dd'); % about 0.5s on my machine
toc

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

질문:

2012년 1월 12일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by