how do i change a scientific figures?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
YJ
el 26 de Mzo. de 2014
Editada: Mischa Kim
el 26 de Mzo. de 2014
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/159476/image.png)
here is my plot graph from my data.
I used following code to display my data on the graph
strValues = strtrim(cellstr(num2str([X(:) Y(:)],'(%d,%d)'))); text(X,Y,strValues,'VerticalAlignment','bottom');
However, it seems the figures are printed in a long numbers..
for instance, 7.5 to be 7.50000
whereas I want it to be just 7.5
so, how do i fix this?
Cheers
0 comentarios
Respuesta aceptada
Mischa Kim
el 26 de Mzo. de 2014
Editada: Mischa Kim
el 26 de Mzo. de 2014
YJ, how about this:
X = '0.0000012345';
Y = '0.0987654321';
strValues = sprintf('(%4.1e,%4.1e)',str2num(X),str2num(Y));
text(0.1,0.1,strValues,'HorizontalAlignment','left');
Simply, copy-paste-execute to see if this would do the trick. Check out the documentation for the sprintf command for formatting guidelines.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!