フィルターのクリア

Read data from text file

2 ビュー (過去 30 日間)
Artyom
Artyom 2012 年 7 月 12 日
Hi, everyone. I have .txt data file. Each new line begins with date in format mm/dd/yyyy, for example 06/25/2012. Part of the code:
A = fscanf(fid, '%g/%g/%g, ...
But dates write in 3 columns like [6 25 2012 ...]. Should I leave it or write date in one column as [06/25/2012 ... ]. The goal is to take a part of the history (for example from 6/25/2001 to 6/25/2002). What is the best way to do it?
  2 件のコメント
Jan
Jan 2012 年 7 月 12 日
You forgot to mention, which format you want instead of the three columns.
Artyom
Artyom 2012 年 7 月 12 日
編集済み: Artyom 2012 年 7 月 12 日
I think text string as '06/25/2012'. The only question: what is better for search?

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2012 年 7 月 12 日
編集済み: Jan 2012 年 7 月 12 日
Dates in three columns are fine. To convert them to serial date numbers, use datenum.
A = [6, 25, 2012];
DateNumber = datenum(A(3), A(2), A(1))
  3 件のコメント
Jan
Jan 2012 年 7 月 12 日
I do not understand the question. Could you post an explicit example of the input and output?
Artyom
Artyom 2012 年 7 月 12 日
Ok, we have data in text file like:
02/27/2007 .....
....
02/27/2012 .....
How can I easily take data from 01/01/2009 to 01/01/2010 and put it to a new matrix.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by