matrix indexing all indexes except one
Mostrar comentarios más antiguos
I have got a n^m matrix which changes for every look and would like to store this sequence of matrices. I don't know by default what will be m and n. Something like YY(:,:,:,:,j)=Y; or YY(:,:,:,j)=Y; if the dimension would be known in forehand. Thank you very much. (Note that in the example is the dimension of Y first 4 and the 3.)
Respuesta aceptada
Más respuestas (1)
KSSV
el 1 de Nov. de 2017
YOu can initialize it by using [] in-place of dimensions. Check the below code:
a = zeros([],[]) ;
for i = 1:10
for j = 1:5
a(i,j) = rand ;
end
end
1 comentario
Rafael Schwarzenegger
el 1 de Nov. de 2017
Editada: Rafael Schwarzenegger
el 1 de Nov. de 2017
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!