1 Star 0 Fork 0

xingchigang/WiFi-MATLAB-Simulator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
findEvent.m 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
function [wantedEventArrInd] = findEvent(eventID, eventStation, eventsList)
% finds an event from the specified type of the specified station
% returns the index of the wanted event if exists
% eventTypesEnums = cellfun(@(s)s.type, eventsList,'uni',0);
% eventTypeNums = cellfun(@(s)double(s), eventTypesEnums,'uni',0);
% eventsTypes = cell2mat(eventTypeNums);
% curTypeEvents = (eventsTypes == e.type); % binary rep. for only this type of event (1 for this type, 0 otherwise)
%
% eventsStations = cell2mat(cellfun(@(s)s.station, eventsList,'uni',0));
% curStationEvents = (eventsStations == e.station); % binary rep. for only this station's events (1 for this station's events, 0 otherwise)
%
% eventsTimes = cell2mat(cellfun(@(s)s.time, eventsList,'uni',false));
% curTimeEvents = (eventsTimes == e.time); % binary rep.
%
% timerTypesEnums = cellfun(@(s)s.timerType, eventsList,'uni',false);
% timerTypeNums = cellfun(@(s)double(s), timerTypesEnums,'uni',0);
% eventsTimerTypes = cell2mat(timerTypeNums);
% allCN = [eventsList.id]; % comma separated list expansion
id_ind = [eventsList.id] == eventID;
station_ind = [eventsList.station] == eventStation;
wantedEventArrInd = find(id_ind & station_ind); % events which satisfies both conditions - just in case
% eventsIDs = cell2mat(cellfun(@(s)s.id, eventsList,'uni',0));
% curIDEvent = (eventsIDs == eventID); % binary rep. for only this station's events (1 for this station's events, 0 otherwise)
%
% eventsStations = cell2mat(cellfun(@(s)s.station, eventsList,'uni',0));
% curStationEvents = (eventsStations == eventStation); % binary rep. for only this station's events (1 for this station's events, 0 otherwise)
%
% wantedEventArrInd = find(curIDEvent & curStationEvents); % events which satisfies both conditions - just in case
% disp(wantedEventArrInd);
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xingchigang/WiFi-MATLAB-Simulator.git
git@gitee.com:xingchigang/WiFi-MATLAB-Simulator.git
xingchigang
WiFi-MATLAB-Simulator
WiFi-MATLAB-Simulator
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385