what is meant by sparse(0)?
Show older comments
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?
Answers (1)
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!
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!