Effortlessly Display a Matrix of Numbers in Mathematica | Quick Solution

  • Context: Mathematica 
  • Thread starter Thread starter iva_bg
  • Start date Start date
  • Tags Tags
    Mathematica Table
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 4K views
iva_bg
Messages
8
Reaction score
0
Hello,

does anyone have an idea how easily to display a matrix of numbers such that each entry, for example 3, is displayed (3%), without having to type it manually, i.e. a command to do it for each entry in my output matrix?

Thanks a lot!
 
Physics news on Phys.org
Maybe something like
Code:
(* I suppose you already have a matrix mat, e.g.: *)
mat = {{1, 2, 3}, {4, 5, 6}, {7, 8,9}}; 

FormatNumber[x_] := ToString[x] <> "%"

Map[FormatNumber, mat, {2}]
% // MatrixForm
 
Thank you, this is fantastic!