Consider a table


I want to convert it into a table where all the numbers are only with 4 digits after the comma, and then export it (to save size of the output file).

This is what I do:

tabbSh={NumberForm[#[[1]], 4],NumberForm[#[[2]], 4]}&/@tabb

However, the elements of the resulting table become non-numeric. Could you please tell me how to fix this problem?

  • 5
    $\begingroup$ When you say 4 digits, do you want a rounding or truncation? e.g., Round[tabb, 0.0001] $\endgroup$
    – Syed
    Commented Feb 20, 2023 at 10:40
  • 2
    $\begingroup$ If you just want to truncate digits, you can try something like: foo[x_, n_] := N[FromDigits[RealDigits[x, 10, n]], n] $\endgroup$
    – bmf
    Commented Feb 20, 2023 at 10:55
  • 3
    $\begingroup$ Similar questions: 143294 (unanswered) 970, 241413, 19387. In which format do you want to Export? $\endgroup$
    – rhermans
    Commented Feb 20, 2023 at 10:58
  • $\begingroup$ Thank you guys! $\endgroup$ Commented Feb 20, 2023 at 12:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.