Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 40000-by-1. Error in mat (line 73) C(:,s) = g(:);. how to solve this error?

3 views (last 30 days)
This is my code
lx=double(Ix);
ly=double(Iy);
lxy=double(Ixy);
lxx=double(Ixx);
lyy=double(Iyy);
g = sqrt(lx.*lx + ly.*ly);
d = sqrt( (lxx-lyy).^2+ 4*lxy.^2 );
figure, imshow(g),title('I1');
figure, imshow(d),title('I2');
s=sigma;
SI = 0.5-1/pi*atan((-lxx-lyy)./sqrt((lxx-lyy).^2+ 4*lxy.^2));
imshow(SI)
SI_label= atan_vq(SI, Ls);
SI_code(:,s) = SI_label(:);
C(:,s) = g(:);
C(:,s + 1*length(F)) = d(:);
G2=C(:,1:3);
D2=C(:,4:6); % d
r=2/pi*atan(Coef*D2./G2);
help me to solve this error.
  1 Comment
Stephen23
Stephen23 on 23 Aug 2018
Edited: Stephen23 on 23 Aug 2018
"help me to solve this error."
Simple: don't try to allocate 40,000 elements into one element.
Using sigma as an index looks quite suspicious to me... but in any case as we do not have the complete code, any values, or any explanation of what the badly aligned code should be doing, we will have to rely on guessing what you are doing. If you want help, please upload an MWE by clicking the paperclip button.

Sign in to comment.

Answers (1)

Shan Sha
Shan Sha on 23 Aug 2018
I am having many doubts in that code! shall i upload my full code

Categories

Find more on Performance and Memory in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!