필터 지우기
필터 지우기

how to remove trailing zeros after rounding a matrix?

조회 수: 19 (최근 30일)
Deepthi B
Deepthi B 2021년 4월 21일
댓글: Deepthi B 2021년 4월 21일
I need to round a matrix to two decimal places but I want to get rid of those trailing zeros after the decimal point. Even I want to use that matrix for plotting also? How to do it?

답변 (1개)

Stephan
Stephan 2021년 4월 21일
편집: Stephan 2021년 4월 21일
format short
A = 1.23
A = 1.2300
format shortG
A = 1.23
A =
1.23
  댓글 수: 5
Stephan
Stephan 2021년 4월 21일
Can you provide the code?
Deepthi B
Deepthi B 2021년 4월 21일
x =1:1:12;
y = gcmmodels;
subplot(2,2,1)
heat(round(clusteringcoefficientfive,2), x, y,'%0.2f','FontSize', 11,'TickAngle', 0,'ShowAllTicks', true, 'TickFontSize', 10,'GridLines', ':');
subplot(2,2,2)
heat(round(clusteringcoefficientsix,2), x, y,'%0.2f','FontSize', 11,'TickAngle', 0,'ShowAllTicks', true, 'TickFontSize', 10,'GridLines', ':');

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by