Borrar filtros
Borrar filtros

how to display how many looping are working on

1 visualización (últimos 30 días)
Raja Zufar
Raja Zufar el 2 de Ag. de 2020
Respondida: SAA el 6 de Ag. de 2020
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 comentario
Spectro
Spectro el 3 de Ag. de 2020
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..

Iniciar sesión para comentar.

Respuestas (1)

SAA
SAA el 6 de Ag. de 2020
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

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by