# Operator '>=' is not supported for operands of type 'cell'

25 views (last 30 days)
Riccardo Tronconi on 29 Jun 2021
Commented: Stephen23 on 30 Jun 2021
Hi guys I have a problem in comparing two cells.
My input cells are T{n}, where n=3
• T{1} [mx4]
• T{2} [nx4]
• T {3} [k x 4]
and thor cell [sx1] (Data tipe is a datetime)
To simplify I m looking for all index of T{2} that verify the following in which I am comparing datetimes:
find((T{2}(1:end,1))>= thor(1,1) & (T{2}(1:end,1))< thor(2,1));
The problem is the operator but I guess is "1:end" because the following code worked properly..
find(T{2}{2,1}>= thor{2,1} & T{2}{2,1}< thor{3,1});
Stephen23 on 30 Jun 2021
S1 = struct with fields:
thor: {537×1 cell}
Unable to read MAT-file /users/mss.system.YD2TnT/T.mat. File might be corrupt.

VBBV on 29 Jun 2021
find((T{2}(1:end,1))>= thor(1,1) & (T{2}(1:end,1))< thor(2,1),numel(T{2}));
Try with the second argument like above
Riccardo Tronconi on 29 Jun 2021
It does not work either :(

Steven Lord on 29 Jun 2021
T = {[], datetime('tomorrow')}
T = 1×2 cell array
{0×0 double} {[30-Jun-2021]}
thor = {datetime('today')}
thor = 1×1 cell array
{[29-Jun-2021]}
T{2} <= thor{1} % false
ans = logical
0
T{2} <= thor(1) % error
Comparison is not defined between datetime and cell arrays.
The next-to-last line indexes into thor using curly braces to extract the contents of the first cell, the last line indexes into thor using parentheses to extract the first cell.
Riccardo Tronconi on 29 Jun 2021
It does not work either. My T{2} in not a value but an array mx4