extract sub matrix of sub matrix directly
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have matrix a m-by-n-by-p.
b=a(:,:,1) is a sub matrix of a.
I want to extract sub matrix of b (say c) so that
c=b(1:4, 1:4)
Can I extract c from matrix a such as
c=[a(:,:,1)](1:4, 1:4) This means
c=b(1:4, 1:4)
With regards -Abhijit
0 comentarios
Respuesta aceptada
Más respuestas (1)
Dr. Seis
el 20 de Mzo. de 2012
You will have to use reshape if you take a sub-set a different way, e.g.:
>> a = rand(3,3,3);
>> b = a(1:2,1:2,1)
b =
0.3922 0.7060
0.6555 0.0318
>> b = a(1:2,1,1:2)
b(:,:,1) =
0.3922
0.6555
b(:,:,2) =
0.6948
0.3171
>> b = reshape(a(1:2,1,1:2),[2,2])
b =
0.3922 0.6948
0.6555 0.3171
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing 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!