필터 지우기
필터 지우기

How to edit a cell to include a parantheses

조회 수: 1 (최근 30일)
joseph Frank
joseph Frank 2013년 3월 24일
I have a number 7.511502463068333e-04. I want to put it in a cell. I used :
B=[7.511502463068333e-04];
A=num2cell(B);
however i want the number to be in parentheses as a 4 decimal point number. i.e. i want it to appear as:
A='(0.0008)';
How can i do that?

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 24일
편집: Azzi Abdelmalek 2013년 3월 24일
fprintf('(%.4f)\n',B)
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 24일
편집: Azzi Abdelmalek 2013년 3월 24일
copy and paste
B=7.511502463068333e-04;
fprintf('(%.4f)\n',B)
Walter Roberson
Walter Roberson 2013년 3월 24일
A = sprintf('(%.4f)', B);
Or
A = num2str(B, '(%.4f)');
Note: num2cell() is for converting arrays into cell arrays, not for changing them into character format.

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

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by