Set all elements of a sparse matrix to zero

I have 4 sparse matrices A, B, C, and D .
ABCD = [A B; C D];
How can I set the all elements of the sparse matrix B and C to zeros?

3 comentarios

Rik
Rik el 17 de Sept. de 2020
The easiest way is probably to overwrite them by sparse arrays of the same size.
James Tursa
James Tursa el 17 de Sept. de 2020
Do you mean you have ABCD and want to 0 out the parts originally associated with the B and C spots? Or do you mean you have A and D and want to built ABCD with effectively 0 for the B and C spots?
Bruno Luong
Bruno Luong el 17 de Sept. de 2020
Editada: Bruno Luong el 17 de Sept. de 2020
Strictly speaking, your question is trivial to answer!
B(:) = 0;
C(:) = 0;
I challenge you to tell me why this doesn't answer your question.
Just to show how your question is in fact ill-formulated.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.

Preguntada:

NA
el 17 de Sept. de 2020

Respondida:

el 18 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by