MATLAB Why Must Vectors Be the Same Length?

  • Thread starter Thread starter starbaj12
  • Start date Start date
  • Tags Tags
    Error Vectors
AI Thread Summary
The error message "Vectors must be the same lengths" in MATLAB indicates that a function requires its input arguments to be vectors of equal length. This is particularly relevant in functions like plot(A, B), where both A and B must contain the same number of elements. In MATLAB, all data is treated as matrices, and when calling functions, it's essential to ensure that the arguments provided meet the length requirements to avoid this error. Users should check their input vectors to confirm they have the same number of values before executing the function.
starbaj12
Messages
48
Reaction score
0
What does it mean when it says error: Vectors must be the same lengths
 
Physics news on Phys.org
this usually occurs when arguments to a function are required to be of same length especially in something like plot(A,B) ...

As u know anything and everything in MATLAB is a matrix and ofcourse arguments are vectors. So u must have called some function with arguments which needs argument with equal "number" of values ...

-- AI
 

Similar threads

Replies
2
Views
1K
Replies
4
Views
1K
Replies
2
Views
3K
Replies
5
Views
2K
Replies
5
Views
2K
Replies
4
Views
3K
Replies
8
Views
2K
Replies
2
Views
2K
Back
Top