필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

The loop is causing time out so i want to convert it to matrix operations.

조회 수: 1 (최근 30일)
MSDataSpl1
MSDataSpl1 2017년 6월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
I ave re written my doubts so please consider it now,
for i = 2 : LenRxDiv
UsedAnt = currAnt(i-1);
%UsedAnt = currAnt(1:LenRxDiv);
StartTime = currTime(i-1);
%StartTime[1:LenRxDiv] = currTime(1:LenRxDiv);
%check for intersection with CQI
IntersLen = min([(ActTimeStop - StartTime) (currTime(i) - ActTimeStart) repmat((currTime(i) - StartTime),NumActReg,1) (ActTimeStop - ActTimeStart)], [], 2);
%IntersLen[1:LenRxDiv] = min([(ActTimeStop[1:LenRxDiv] - StartTime[1:LenRxDiv]) (currTime[1:LenRxDiv] - ActTimeStart[1:LenRxDiv]) repmat((currTime[1:LenRxDiv] - StartTime[1:LenRxDiv]),NumActReg[1:LenRxDiv],1) (ActTimeStop[1:LenRxDiv] - ActTimeStart[1:LenRxDiv])], [], 2);
UtilHSDPA(UsedAnt) = UtilHSDPA(UsedAnt) + sum(IntersLen(IntersLen>0));
UtilAll(UsedAnt) = UtilAll(UsedAnt) + currTime(i) - StartTime;
end
These are the values of above code:
when i = 2
LenRxDiv : 1*1 double = 725590
UsedAnt :1*1 double = 2
IntersLen : 120936 * 1 double = -5238 -88277/3 .... ..... ..... .....
StartTime :1*1 double = 2046467740
ActTimeStop : 120936 * 1 double = 2046462502 .... .... ...... .....
ActTimeStart : 12093 * 1 double = 2046462502 .... .... .... ....
CurrTime(i) : 725590 * 1 double = 20464627740 ..... .... .....
NumActReg : 1 * 1 double = 120936
UtilHSDPA(UsedAnt) : 1 * 4 double = 0 0 0 0
so now could someone please explain how can remove the loop from above code since its causing timeout and can it be converted into matrix manipulation.
  댓글 수: 6
MSDataSpl1
MSDataSpl1 2017년 8월 1일
편집: dpb 2017년 8월 1일
Even when i am using the change you mentioned
IntersLen=min([(ActTimeStop-StartTime) (currTime(i)-ActTimeStart) ...
(currTime(i)-StartTime) (ActTimeStop-ActTimeStart));
then i am getting the error,
Dimensions of matrices being concatenated are not consistent.
MSDataSpl1
MSDataSpl1 2017년 8월 1일
I want to find the minimum value of the matrices so i am using min function but the problem is the dimension of matrix should be same so i am using repmat but it causing timeout when used for multiple iterations, so is there any substitut for repmat

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by