assigning array to another
43 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello Matlab
el 3 de Abr. de 2015
Comentada: Hello Matlab
el 3 de Abr. de 2015
I'm struggling with the rows index of the matrix.
First I have Matrix A which is 1125 X 30 dimensions. I want to initialize Matrix B as 10 X 30, first as zeros and then matrix B takes the first ninth rows of matrix A, and keep its last rows as zeros. How can I do that?
6 comentarios
Respuesta aceptada
James Tursa
el 3 de Abr. de 2015
Editada: James Tursa
el 3 de Abr. de 2015
Is this what you want?
B = zeros(10,30); % initialize Matrix B as 10 X 30, first as zeros
B(1:9,:) = A(1:9,:); % B takes the first ninth rows of matrix A
Más respuestas (0)
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!