How to expand a matrix depending on the file size?
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I want to plot error bars of data that can have different number of elements. But the data always contains four different types and should be plotted in four colors. For example, if data has 16 elements, the colors should be (1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4) and if the data has only 4 elements, the color index should only be (1 2 3 4). How can I have flexible indexing dependent on number of items?
2 commentaires
Réponse acceptée
  Sylvain
      
 le 18 Jan 2023
        Does this help ?
n = 2;
mycolors = [1*ones(1,n),2*ones(1,n),3*ones(1,n),4*ones(1,n)];
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Annotations dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


