What this means sum( time(i,1:i-1) ) ?

2 visualizaciones (últimos 30 días)
Ami
Ami el 4 de Jun. de 2011
time is a 5X5 matrix I want to know what means time(i,1:i-1) , I'm new at matlab
But I mean what does i,1:1-1 do whit the matrix, I know the results that this send, but I want to know like, It means that is taking the data from the matrix at.... something like that, thanks...

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 4 de Jun. de 2011
See it yourself: type the following lines one at time at the Matlab command window
time=magic(5)
i=4
time(i,1:i-1)
sum(time(i,1:i-1))
  2 comentarios
Matt Fig
Matt Fig el 4 de Jun. de 2011
Or, perhaps:
time = magic(5)
for ii = 1:5
T = time(ii,1:ii-1)
sum(T)
end
Run this and look at the output...
Fangjun Jiang
Fangjun Jiang el 4 de Jun. de 2011
Good catch, Matt! I changed the value of i from 1 to 4 to avoid confusion.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Frequently-used Algorithms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by