what is meant by sparse(0)?

I know that if i write S=sparse(A) then it converts a full matrix into sparse form by squeezing out any zero elements. But if i write:
Mechanical_Load_External(1:Number_of_Cells*New_Dimension,1)=sparse(0);
then what does it mean? What value is assigned to the elements of the matrix?

Réponses (1)

Adam
Adam le 19 Juil 2017
Modifié(e) : Adam le 19 Juil 2017

0 votes

Surely you can just test this in 5 seconds on the command line?
K>> sparse(0)
ans =
All zero sparse: 1×1
Or read the documentation at
doc sparse
In this case it does exactly what you said for A, but with A = 0 so you end up with a scalar sparse matrix with no non-zero element. Which seems rather pointless, but I have no idea where the code you posted comes from and whether it is intended to make any sense or is just bad code!

Catégories

En savoir plus sur Sparse Matrices dans Centre d'aide et File Exchange

Modifié(e) :

le 19 Juil 2017

Community Treasure Hunt

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

Start Hunting!

Translated by