I want to save two sparse matrix Y and R to a mat file. However, when I run the following code, I found out that the twomatrices.mat contains two full matrices instead of sparse matrices. Do does .mat file only allow full matrices to be included?
save('twomatrices.mat', 'Y', 'R');
Be sure that you actually create sparse matrices: e.g., the following code snippet works fine and stores the matrices as sparse double matrices: