How can I replace every element of a matrix with a special character to hide the element
古いコメントを表示
I have a nxn matrix and want to hide the elements and replace them with a special character
Example
1 2 3
4 5 6
7 8 9
is now
* * *
* * *
* * *
1 件のコメント
Walter Roberson
2015 年 11 月 26 日
"hide them" in what context?
採用された回答
その他の回答 (2 件)
Rick Rosson
2015 年 11 月 27 日
x = magic(3);
x(x<7) = NaN;
disp(x);
Image Analyst
2015 年 11 月 27 日
Try this, using fprintf():
m = [...
1 2 3
4 5 6
7 8 9]
[rows, columns] = size(m);
for row = 1 : rows
for col = 1 : columns
fprintf('* ');
end
fprintf('\n');
end
カテゴリ
ヘルプ センター および File Exchange で Matrix Operations and Transformations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!