Borrar filtros
Borrar filtros

find matching multiple condition

4 visualizaciones (últimos 30 días)
Greg LANGE
Greg LANGE el 21 de Abr. de 2023
Editada: chicken vector el 21 de Abr. de 2023
I have to reset a system. if the current time match with the moment reset should be true.
I tried to avoid using if with multiple conditionS
i tried this code which is not working for me.
load('resettimehelp.mat)'
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
dr(:,1)=day(reset_system{:,1});
monthr(:,1)=month(reset_system{:,1});
yearsr(:,1)=year(reset_system{:,1});
heurer(:,1)= hour(reset_system{:,1});
minuter(:,1)=minute(reset_system{:,1});
dT(:,1)=day(Time([1:10]));
monthT(:,1)=month(Time([1:10]));
yearsT(:,1)=year(Time([1:10]));
heureT(:,1)= hour(Time([1:10]));
minuteT(:,1)=minute(Time([1:10]));
current_time=2
k=find(dT(current_time)==dr(:)&& minuteT(current_time)== minuter(:) );
I methodolgy is if sum(k(:))>0 then reset = true;
Do you have a solution or another way to solve this question
thank you in advance

Respuesta aceptada

chicken vector
chicken vector el 21 de Abr. de 2023
Editada: chicken vector el 21 de Abr. de 2023
k will be true (or logical 1) if reset needs to be applied.
false (or logical 0) otherwise.
load('resettimehelp.mat');
current_time = 2;
k = ismember(Time(current_time), datetime(reset_system{:,1}));
ans =
logical
1

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by