could anyone help me how to remove the zeros that comes after the number present after the decimal

how to display the matrix by removing the zeros that comes after the number.
[ 0 0.5800 1.3300 2.5300 2.1200 1.8100;
0.5800 0 1.8600 2.6100 2.4800 1.5300;
1.3300 1.8600 0 2.1800 1.1900 2.4200;
2.5300 2.6100 2.1800 0 1.2300 1.6200;
2.1200 2.4800 1.1900 1.2300 0 2.2400;
1.8100 1.5300 2.4200 1.6200 2.2400 0]
I want to have the matrix in the folowing manner
[ 0 0.58 1.33 2.53 2.12 1.81;
;;
;;
;;
;;
1.81 1.53 2.42 1.62 2.24 0]
could anyone please help me on it.

Answers (1)

Use
format shortG:
A =
12.3400 2.3400
>> format shortG
>> A
A =
12.34 2.34

This question is closed.

Tags

Asked:

on 22 Oct 2019

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!