MATLAB: Error: Unable to perform assignment because the left and right sides have a different number of elements. error I am unable to get this for loop working for some reason, I know it is in line 28 but not sure. Thanks for any help. Best Answer You are using a double for loop. I advise its best to use something like thisfor ii=1:24 for jj=1:24 z(ii,jj)=normrnd(mu_SC(ii),std_SC(jj),1000); endend Related SolutionsMATLAB: Matrix reshaping and combination cd(24:24:end,4) MATLAB: Unable to perform assignment because the left and right sides have a different number of elements. Is it due to the vector stuff? How to solve it. Thanks in advance I has the size of 2x(length(a)). When you are setting I you are only indexing the second dimension. What is the size of sys.Measurements?If the size is 2x1 try this:I(:,ii) = sys.Yss_Measurements;If the size is 1, then you either need to set it to:I(1,ii) = sys.Yss_Measurements;orI(2,ii) = sys.Yss_Measurements; Related QuestionHow to make a log operation for a matrix excluding the ‘-inf’ valuesPre allocating triple loops
Best Answer