how to filter particular set of dates from a column?
eg
if we have a column like this
19790914
19791219
19800310
19800622
....
20001231
how to remove/filter dates from 19800310 to 19901214. after this in this output how to add one date before 19800310?

 採用された回答

KSSV
KSSV 2021 年 10 月 28 日

0 投票

Convert the dates to datenum and use logical indexing i.e. use inequalitties.

3 件のコメント

Suresh R
Suresh R 2021 年 10 月 28 日
how to add one date in beginninng?
KSSV
KSSV 2021 年 10 月 28 日
DEfine the date and append.
A = rand(1,3) ;
A = [rand A]
Suresh R
Suresh R 2021 年 10 月 28 日
thank you!!

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 10 月 28 日

0 投票

idx = find(19800310 <= column & column <= 19901214);
At this point you can select corresponding values by
selected_data = YourData(idx,:);
and you can reject corresponding values by
other_data = YourData; other_data(idx,:) = [];
If you are selecting and you want to add an entry before 19800310 then
selected_plus = [Additional_data; selected_data];
If you are rejecting and you want to add an entry where 19800310 would have been then
other_plus = [other_data(1:idx(1)-1, :); Additional_Data; other_data(idx(1):end,:)];

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

タグ

質問済み:

2021 年 10 月 28 日

コメント済み:

2021 年 10 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by