Matrix dimensions must agree.

Basic question about MATLAB programming
Post Reply
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Matrix dimensions must agree.

Post by matlab1 »

One of the common error in MATLAB is :
Matrix dimensions must agree.

This error happen in many situation :

When you wan to put the output of an array in a another array. for example :

A = zeros (3,1)

B =[5,6]

if you write :

A=B

MATLAB will appear this error for you. As you see length of A is 3, But length of B is 2 . So, MATLAB can not put two values in three places.
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests