Info
This question is closed. Reopen it to edit or answer.
Matrix dimensions must agree error
3 views (last 30 days)
Show older comments
I am sure I used this exact code yesterday without problems (line 27)
Matrix dimensions must agree.
Error in abs_threshold_colorationuser (line 27)
m_test(start_idx:end_idx) = m_test(start_idx:end_idx) + 10^(M.VAR/20)*y2;
Error in mpsy_check (line 208)
eval([M.EXPNAME 'user']);
Error in mpsy_afc_main (line 60)
mpsy_check;
Error in abs_threshold_coloration (line 71)
mpsy_afc_main;
Marius
0 Comments
Answers (1)
Guillaume
on 19 Feb 2020
First, do not use eval. It's not the cause for your problem here but it's a very dangerous tool which typically makes it harder to debug your code. It's also completely unneeded here,
M.([EXPNAME, 'user']); %and use , to separate expressions in [], the lack of , is also a typical source of bugs.
would work just as well.
As for the error, we don't have enough information to say what the problem is exactly, most likely the size of m_test(start_idx:end_idx) is not the same as the size of 10^(M.VAR/20)*y2 and the most likely reason for that is that y2 doesn't have end_idx-start_idx+1 elements or if it has, is not a vector. Since we don't know the size of the variables, their shape, or where they come from, we can't help you further.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!