regress error, number of rows

7 views (last 30 days)
Hej,
I try to do a multi linear regression between two vectors, but I recieve an error in the length of the vector, although the number of rows is equal (size: 1540x4 and size: 1540x1), see below. Can anyone explain this error and how to fix it?
cheers,
Jeroen
>> b = regress(Mean_wall_1(:,[5 10 11 12]),Q_201_cl(:,2));
Error using regress (line 62)
Y must be a vector and must have the same number of rows as X.
>> size(Mean_wall_1(:,[5 10 11 12]))
ans =
1540 4
>> size(Q_201_cl(:,2))
ans =
1540 1

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 25 Feb 2019
Switch your X and Y. Read the help of regress()
  2 Comments
Jeroen van Eldert
Jeroen van Eldert on 25 Feb 2019
Thanks,
I overlooked in 4 times, still the error message does not make sence..
/Jeroen
Fangjun Jiang
Fangjun Jiang on 25 Feb 2019
Agreed. Many times the error message is rather confusing.

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!