Why do I get the error 'CAT arguments dimensions are not consistent'?
    27 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    MathWorks Support Team
    
 el 27 de Feb. de 2012
  
    
    
    
    
    Editada: MathWorks Support Team
    
 el 14 de Oct. de 2022
            Why do I get the following error message:
ERROR: Error: CAT arguments dimensions are not consistent.
Respuesta aceptada
  MathWorks Support Team
    
 el 14 de Oct. de 2022
        
      Editada: MathWorks Support Team
    
 el 14 de Oct. de 2022
  
      Explanation:
You are attempting to concatenate two arrays using [] but the appropriate dimensions along which to concatenate are not the same size.
Common causes:
You have forgotten a semicolon (;) or a comma (,) when attempting to concatenate two character arrays, or you are using the wrong separator. This error commonly occurs when attempting to concatenate character arrays to try to create a multi-line string.
Solution:
Examine the line listed in the error message and insert the appropriate matrix element separator. Also verify that the dimensions along which you are trying to concatenate the matrices agree. The help files for the HORZCAT and VERTCAT functions describe the relationship that needs to exist for this concatenation to work correctly.
horzcat(A,B)
is the equivalent of [A B] while
vertcat(A,B)
is the equivalent of [A;B]. If you are attempting to concatenate strings, you should use the STRCAT and STRVCAT functions, which handle adjusting the appropriate dimensions automatically if it is necessary.
Example demonstrating this error:
BracketedExpressionDimensions.m
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Creating and Concatenating Matrices 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!
