using num2str for subplot titles
    31 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    mehra
 el 18 de En. de 2023
  
    
    
    
    
    Respondida: Alan Stevens
      
      
 el 18 de En. de 2023
            Hello guys
In my code I need to have varying subplot titles like Q1S1, Q1S2 and Q1S3 (respectively for subplot 1 to 3 (first row)) ,I am using the following code but it seems there is some thing missing that I get error: Incorrect number of input arguments
Any Idea what I am missing?
for k=1:3
    subplot(3,3,k)
    plot(Q1S(:,k),depth_z,'.-',A_Q1S(:,k),depth_z,'.',B_Q1S(:,k),depth_z,'o',C_Q1S(:,k),depth_z,'*')
    title('Q1S', num2str(k)) % the output I want is Q1S1, Q1S2 and Q1S3
    xlabel('Velocity($m/s$)','interpreter','latex','fontsize',10);
    ylabel('water depth($m$)','interpreter','latex','fontsize',10);
end
0 comentarios
Respuesta aceptada
  Alan Stevens
      
      
 el 18 de En. de 2023
        Try
 title(['Q1S', num2str(k)])
i.e. enclose the two terms within square brackets.
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Subplots 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!

