Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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
String 在matlab中查找单元格格式的信息_String_Matlab_Cell - Fatal编程技术网

String 在matlab中查找单元格格式的信息

String 在matlab中查找单元格格式的信息,string,matlab,cell,String,Matlab,Cell,我有以下手机: matr = '01/07/2012' '00:00' [ 0.2000] '05/07/2012' '17:00' [ 1] '05/07/2012' '20:00' [ 8.4000] '05/07/2012' '21:00' [ 1.2000] '06/07/2012' '02:00' [ 0.4000] '06/07/2012'

我有以下手机:

matr = '01/07/2012'    '00:00'    [ 0.2000]
       '05/07/2012'    '17:00'    [      1]
       '05/07/2012'    '20:00'    [ 8.4000]
       '05/07/2012'    '21:00'    [ 1.2000]
       '06/07/2012'    '02:00'    [ 0.4000]
       '06/07/2012'    '19:00'    [      5]
       '07/07/2012'    '01:00'    [      7]
       '08/07/2012'    '00:00'    [ 4.2000]
       '08/07/2012'    '01:00'    [      3]
       '08/07/2012'    '04:00'    [ 0.2000]
       '09/07/2012'    '16:00'    [ 0.2000]
       '09/07/2012'    '23:00'    [      3]
       '22/07/2012'    '20:00'    [ 4.2000]
       '23/07/2012'    '20:00'    [ 1.2000]
       '23/07/2012'    '22:00'    [ 5.4000]
       '25/07/2012'    '22:00'    [14.6000]
       '27/07/2012'    '21:00'    [ 0.2000]
       '28/07/2012'    '23:00'    [ 0.2000]
       '30/07/2012'    '20:00'    [ 0.2000]

我只想选择20:00到23:00之间的信息。一旦matr(:,2)是一个字符串信息,我该如何处理呢?

如果您只关心小时,那么就使用该列创建一个索引数组。这可以通过datevec函数快速完成

[~,~,~,H] = datevec(matr(:,2));
idx = H >= 20 & H <= 23;
matr(idx,:)
[~,~,~,H]=datevec(matr(:,2));

idx=H>=20&H您需要将时间信息转换为数字,以便可以使用>或<运算符进行比较,请参见此