Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Matlab: Subscripted assignment dimension mismatch

Tags:

matlab

I have this problem and can't figure out what the problem is.

for i=1:e
    s  = size(E_{i});
    r2 = s(1);
    E_{i}(1:r2,3) = (E_{i}(:,2))/(E_{i}(:,1));
end

Subscripted assignment dimension mismatch.

like image 415
user2565552 Avatar asked Jul 17 '26 05:07

user2565552


2 Answers

You are using /, which is matrix division. Try using ./ (element-wise division), so that you get as many output elements as there are in input operands.

like image 54
dunadar Avatar answered Jul 18 '26 21:07

dunadar


Have you tried looking at what size "(E_{i}(:,2))/(E_{i}(:,1));" is? Hint: you probably meant to use ./ instead of /.

like image 26
Hugh Nolan Avatar answered Jul 18 '26 21:07

Hugh Nolan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!