Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to set unlabeled values in matrix to zero
1 回表示 (過去 30 日間)
古いコメントを表示
Hello everyone!
I have a 1536 x 2048 matrix. For visualization purposes I preprocessed 1Mio random data points and labeled them. Now I want to plot the previous matrix, but set the values of the other 2 Mio data points to zero in order to make the processed ones visible. Is this even possible? I'd be super grateful if you guys could help.
Thank you in advance
2 件のコメント
Rafael Hernandez-Walls
2020 年 8 月 26 日
spy(S)
plots the sparsity pattern of matrix S. Nonzero values are colored while zero values are white
回答 (1 件)
Rishabh Mishra
2020 年 9 月 3 日
Assuming the name of the matrix variable as 'mat'
To set unlabeled matrix values to 0, consider the pseudocode below:
for i = 1:1536
for j = 1:2048
If mat(i)(j) is unlabeled
Set mat(i)(j) to 0
end
end
To visualize sparsity pattern of the matrix, use the code below.
>> spy(mat)
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!