Divide by 2 every second double column without losing structure of cell array
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
Hello, I have a big cell array, every Cell has 2 columns. Hove can I divide by 2 every second double column without losing structure of cell array?
Test =
1×189 cell array
Columns 1 through 5
{14×2 double} {9×2 double} {3×2 double} {4×2 double} {7×2 double}
Columns 6 through 10
{5×2 double} {8×2 double} {7×2 double} {12×2 double} {6×2 double}
Columns 11 through 15
.......
For example:
1.11 490
1.14 492
1.17 488
1.20 484
to
1.11 245
1.14 246
1.17 244
1.20 242
somethink like this, but its a wrong code
Test{1,:}=Test{1,{:}/2}
Thank you!
Respuestas (2)
Deepak Gupta
el 18 de Jun. de 2020
Below program should work for your problem:
test = {[10, 15], [20, 30]};
for index = 1: length(test)
test{index}(:, 2) = test{index}(:, 2)/2;
end
1 comentario
Nik Rocky
el 18 de Jun. de 2020
Vinayak Mohite
el 18 de Jun. de 2020
Hi Nikita,
I am assuming that you want to divide the second column in the table by 2.
Here is the way to do it.
Test{:, 2} = Test{:, 2}./2
1 comentario
Nik Rocky
el 18 de Jun. de 2020
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!