필터 지우기
필터 지우기

how to display how many looping are working on

조회 수: 1 (최근 30일)
Raja Zufar
Raja Zufar 2020년 8월 2일
답변: SAA 2020년 8월 6일
Hallo i have this part of code,
I want to see how many TTI looping are working on in the "command window" bar. because I don't know how long this program will run and how many repetitions have happened
TTI=1000;
for x=1:TTI
[r_TxPU_TTI(:,x), r_TxPU_RxPU_TTI(:,x), r_TxSU_TTI(:,x),r_TxSU_RxSU_TTI(:,x), r_TxSU_RxPU_TTI(:,((jumlah_SU*x) -var):(x*jumlah_SU)),r_TxPU_RxSU_TTI(:,((jumlah_SU*x)-var):(x*jumlah_SU))] = generate(radius_cell, radius_Tx, teta_cell, jumlah_PU, jumlah_SU);
end
Thank you :))
  댓글 수: 1
Spectro
Spectro 2020년 8월 3일
Simply add disp(x) to the body of the cycle like below:
TTI=1000;
for x=1:TTI
[r_TxPU_TTI(:,x), r_TxPU_RxPU_TTI(:,x), r_TxSU_TTI(:,x),r_TxSU_RxSU_TTI(:,x), r_TxSU_RxPU_TTI(:,((jumlah_SU*x) -var):(x*jumlah_SU)),r_TxPU_RxSU_TTI(:,((jumlah_SU*x)-var):(x*jumlah_SU))] = generate(radius_cell, radius_Tx, teta_cell, jumlah_PU, jumlah_SU);
disp(x)
end
or look up fprintf(), but i think disp() should do if your goal is just to know in what iteration you are..

댓글을 달려면 로그인하십시오.

답변 (1개)

SAA
SAA 2020년 8월 6일
you can just type x in yout loop and see what it is
TTI=1000;
for x=1:TTI
[r_TxPU_TTI(:,x), r_TxPU_RxPU_TTI(:,x), r_TxSU_TTI(:,x),r_TxSU_RxSU_TTI(:,x), r_TxSU_RxPU_TTI(:,((jumlah_SU*x) -var):(x*jumlah_SU)),r_TxPU_RxSU_TTI(:,((jumlah_SU*x)-var):(x*jumlah_SU))] = generate(radius_cell, radius_Tx, teta_cell, jumlah_PU, jumlah_SU);
x
end
or as Spectro suggeste use disp or frprintf, this one is better
TTI=1000;
for x=1:TTI
[r_TxPU_TTI(:,x), r_TxPU_RxPU_TTI(:,x), r_TxSU_TTI(:,x),r_TxSU_RxSU_TTI(:,x), r_TxSU_RxPU_TTI(:,((jumlah_SU*x) -var):(x*jumlah_SU)),r_TxPU_RxSU_TTI(:,((jumlah_SU*x)-var):(x*jumlah_SU))] = generate(radius_cell, radius_Tx, teta_cell, jumlah_PU, jumlah_SU);
fprintf('Iteration #%d\n', x);
end

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by