How can I replace every element of a matrix with a special character to hide the element
Mostrar comentarios más antiguos
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 comentario
Walter Roberson
el 26 de Nov. de 2015
"hide them" in what context?
Respuesta aceptada
Más respuestas (2)
Rick Rosson
el 27 de Nov. de 2015
x = magic(3);
x(x<7) = NaN;
disp(x);
Image Analyst
el 27 de Nov. de 2015
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
Categorías
Más información sobre Matrix Operations and Transformations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!