Matrix data
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a 5x5 matrix
lets say i initialise my x=tmp([1;2;4]); as my initial state i only want the first column and row 1 2 and 4 data.
I am doing a looping and how do i get the data in my loop to get column 2 row 1 2 and 4 data in my 2nd loop and the subsequent column in my subsequent looping?
I only need the row 1 2 and 4 data for each column during each increment of my loop
thanks.
0 comentarios
Respuesta aceptada
Chandra Kurniawan
el 11 de En. de 2012
A = round(10*rand(5,5))
tmp = [1 2 4];
for col = 1 : 5
B(:,col) = A(tmp,col);
end
The result :
A =
9 4 1 9 1
1 9 9 6 2
4 2 6 4 1
3 3 5 5 2
8 1 1 4 2
B =
9 4 1 9 1
1 9 9 6 2
3 3 5 5 2
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical 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!