How to edit a cell to include a parantheses
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2013년 3월 24일
편집: Azzi Abdelmalek
2013년 3월 24일
fprintf('(%.4f)\n',B)
댓글 수: 3
Azzi Abdelmalek
2013년 3월 24일
편집: Azzi Abdelmalek
2013년 3월 24일
copy and paste
B=7.511502463068333e-04;
fprintf('(%.4f)\n',B)
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.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!