Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何创建;日期“;Matlab中的容器,忽略月份和年份?_Matlab_Date_Binary_Containers_Extract - Fatal编程技术网

如何创建;日期“;Matlab中的容器,忽略月份和年份?

如何创建;日期“;Matlab中的容器,忽略月份和年份?,matlab,date,binary,containers,extract,Matlab,Date,Binary,Containers,Extract,我的目标是从属于特定“日期”容器的表(见下文)中提取特定行,例如,月末(25-31,不考虑月份和年份)。日期范围为2005年1月至2016年8月,时间步长为“每周” 到目前为止,我只为属于特定日期段的行创建了二进制文件: % T.Date=[datetime(T.Date, 'InputFormat', 'eee dd-MMM-yyyy')]; % Define date containers tlower = datetime(2016,07,25); tupper = dateti

我的目标是从属于特定“日期”容器的表(见下文)中提取特定行,例如,月末(25-31,不考虑月份和年份)。日期范围为2005年1月至2016年8月,时间步长为“每周”

到目前为止,我只为属于特定日期段的行创建了二进制文件:

% T.Date=[datetime(T.Date, 'InputFormat', 'eee dd-MMM-yyyy')];
% Define date containers
  tlower = datetime(2016,07,25);
  tupper = datetime(2016,07,31); 
% Return ones if date falls in between tlower and tupper 
  Binary = isbetween(T.Date,tlower,tupper)
% If "Binary" returns 1, use this row and stack it into a new table 
% with same headers as table "T". -> How?

如何创建忽略月份和年份的日期容器,并返回新表中“月末”(每月25日至31日)的所有行?

如果查看的文档,您将看到有一个
Day
属性可用于创建掩码

例如:

% Generate sample data
dates = datetime(2014,6,28) + calweeks(0:9);
randomdata = rand(1,10);
T = table(dates', randomdata', 'VariableNames', {'Dates', 'Data'})

% Mask and build new table
mask = T.Dates.Day >= 25 & T.Dates.Day <= 31;
newT = T(mask, :)
和一张蒙版表格
newT

newT = 

       Dates        Data  
    ___________    _______

    28-Jun-2014    0.55337
    26-Jul-2014    0.29107
    30-Aug-2014    0.21284

如果查看的文档,您将看到有一个
Day
属性可用于创建掩码

例如:

% Generate sample data
dates = datetime(2014,6,28) + calweeks(0:9);
randomdata = rand(1,10);
T = table(dates', randomdata', 'VariableNames', {'Dates', 'Data'})

% Mask and build new table
mask = T.Dates.Day >= 25 & T.Dates.Day <= 31;
newT = T(mask, :)
和一张蒙版表格
newT

newT = 

       Dates        Data  
    ___________    _______

    28-Jun-2014    0.55337
    26-Jul-2014    0.29107
    30-Aug-2014    0.21284

非常感谢,@excaza!这正是我想要做的,非常感谢,非常感谢,@excaza!这正是我打算做的,非常感谢