フィルターのクリア

subset the plot for the subset of x range

2 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 5 月 25 日
コメント済み: alpedhuez 2020 年 5 月 26 日
I have a plot of date time temperature from Jan1 to Dec 31. I want to create a plot of the same data for Jan 1 to Jun 31. Is there any simpler way to do this?

採用された回答

Alejandro Peñuelas
Alejandro Peñuelas 2020 年 5 月 25 日
There is a built-in funtion included with the financial toolbox.
1) daysact - It can return the number of days between two dates. If you data contains the same number of elements in the year, you can use this function to know where to stop reading the data, exactly in Jun 31.
% Create index to stop reading data
numDays = daysact('1-jan-2019', '31-jun-2019');
% Create the new vector
newData = data(1:numDays);

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 5 月 25 日
See isbetween() or use find(date_vector < last_date_to_plot, 1, 'last') in order to find the end of the group.
In the special case that your time information is from a rowtimes field of a timetable, see https://www.mathworks.com/help/matlab/ref/timerange.html

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by