plot of a string vector vs numeric vector
    15 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Hassan
 el 24 de Jun. de 2011
  
I wonder how to make a plot as X-axis is a text vector. I get an error when I run the folloing code (??? Error using ==> plot Invalid first data argument). I apperciate your help.
y=[1 2 3 4 5 6]
x=['a','b','c','d','e','f']
plot(x,y)
1 comentario
Respuesta aceptada
  Matt Fig
      
      
 el 24 de Jun. de 2011
        y=[1 2 3 4 5 6]
x=['a','b','c','d','e','f']
plot(y)
set(gca,'xticklabel',x.')
2 comentarios
  Christine Abou Nasr
 el 13 de Abr. de 2017
				Hello! and if I want to select just a part of the x table, how can I do? For example, I would like to plot x values 'b' to 'e'. Thank you!
Más respuestas (0)
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!



