How to keep scientific notation in string.
    37 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have some values in an array in matlab
epsilon=[1e-01,9e-02,8e-02]
I want to turn these values into a string so I can use them on plots etc. 
stringepsilon=string(epsilon)
but the output is not in scientific format :
stringeps="0.1" "0.89" "0.08"
how do I make it appear in scientific format.
0 comentarios
Respuestas (2)
  Awais Saeed
      
 el 14 de Dic. de 2021
        
      Editada: Awais Saeed
      
 el 14 de Dic. de 2021
  
      epsilon=[1e-01,9e-02,8e-02];
% try num2str()
str1 = string(num2str(epsilon,'%.e '))
% or try sprintf()
str2 = string(sprintf('%.e ',epsilon))
whos
  Walter Roberson
      
      
 el 14 de Dic. de 2021
        epsilon=[1e-01,9e-02,8e-02];
compose("%.e", epsilon)
0 comentarios
Ver también
Categorías
				Más información sobre Characters and Strings 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!


