How to edit a cell to include a parantheses
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Azzi Abdelmalek
le 24 Mar 2013
Modifié(e) : Azzi Abdelmalek
le 24 Mar 2013
fprintf('(%.4f)\n',B)
3 commentaires
Azzi Abdelmalek
le 24 Mar 2013
Modifié(e) : Azzi Abdelmalek
le 24 Mar 2013
copy and paste
B=7.511502463068333e-04;
fprintf('(%.4f)\n',B)
Walter Roberson
le 24 Mar 2013
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.
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!