matlab - 在matlab中创建一个连续的日期字符串
问题描述
如何在 matlab 中创建这样的连续日期字符串:
'20160801'
'20160802'
'20160803'
.
.
.
'20161031'
解决方案
这应该可以正常工作:
% Define the starting and ending dates from literal representations...
date_start = datetime('20160801','InputFormat','yyyyMMdd');
date_end = datetime('20161031','InputFormat','yyyyMMdd');
% Create a range of dates using the colon operator...
date_range = (date_start:date_end).';
% Convert the dates back to the desired literal format...
date_text = datestr(date_range,'yyyyMMdd');
推荐阅读
- bash - Bash 脚本不允许在压缩文件中使用特殊符号
- php - 方法 Illuminate\Validation\Validator::validateImagetwo 不存在。我想添加两个图像
- c - 如何将 DTYPE 类型的实体分配给 SWAP
- r - 无法从外部 URL 读取压缩的 RDS 文件
- iphone - 如何在智能手机上使用验证工具网络-> 预览进行检查
- javascript - Python烧瓶cors未能通过POST但通过GET
- string - 可以通过递归在两者之间放置空格来形成的字符串数
- html - 相邻按钮导致下方按钮缩进
- react-native - 使用变量时反应原生元素图像组件不显示图像
- c - 请帮我从文件中删除一个空行