Dimensions of arrays being concatenated are not consistent
    7 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Awais Khan
 le 12 Fév 2020
  
    
    
    
    
    Commenté : Walter Roberson
      
      
 le 12 Fév 2020
            Hi community, i am doing a task, of extracting color features and gobar features, after extracting these features, i  am trying to cancate them but it gives error message
                Error using horzcat
                Dimensions of arrays being concatenated are not consistent.
                Error in practice_code (line 19)
                    Fused_Features = [Extracted_Color_Features, Extracted_Gabor_Features];
i am trying to use vertcat and horzcat function for cancatenating these two features the reason of using these two function is because color  features obtained in horizontal position, and gobar features are obtained in vertical features. but still same error are shown. the dimension of color features are 4478x1 and gobar features are 24000x1
so what can i do?
0 commentaires
Réponse acceptée
  Walter Roberson
      
      
 le 12 Fév 2020
                            Fused_Features = [Extracted_Color_Features; Extracted_Gabor_Features];
2 commentaires
  Walter Roberson
      
      
 le 12 Fév 2020
				vertcat is equivalent to using square brackets for vertically concatenating arrays. For example, [A; B] is equal to vertcat(A,B) when A and B are compatible arrays.
horzcat is equivalent to using square brackets for horizontally concatenating arrays. For example, [A,B] or [A B] is equal to horzcat(A,B) when A and B        are compatible arrays.
Phrasing that another way:
- When you write [A, B] or [A B], what really gets called is horzcat(A,B) -- writing [] is "syntactic sugar", something to make programming easier but which is internally translated to something else.
- When you write [A;B], what really gets called is vertcat(A,B) -- more syntactic sugar
Also, when you code
[A
 B]
what really gets called is vertcat(A,B). And
[A B
 C D]
would internally be translated to 
vertcat(horzcat(A, B), horzcat(C, D))
If you happened to have
[A B
 C]
then you should suspect that there is an error, but it is not necessarily an error. The important part is not the number of expressions: it is whether the expressions expand to compatible sizes. It is, for example, completely valid to have
[1 2 3 4
 zeros(1,4)]
which internally would be 
vertcat( horzcat(1,2,3,4), zeros(1,4) )
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Creating and Concatenating Matrices 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!

