<div>Hi all,</div>
<div> </div>
<div>I would appreciate if anyone could suggest a solution for extracting the content of a column vector to a pre-defined matrix size (identical row numbers) within a for loop. I keep getting an error message:Submatrix incorrecly defined...</div>
<div> </div>
<div>my loop is as follows:</div>
<div> </div>
<div> </div>
<div> </div>
<div>for j=1:numpcs do<br>t=X(:,1);//pick the score vector (first column of X)<br>t_pre=t-t;<br> while norm(t-t_pre) > threshold do<br> p=(X'*t)/norm(X'*t);//calculate and normalise the loading vector<br>
t_pre=t;//saving the original vector into t_pre<br> t=X*p;//calculating the new score vector (product of eigenvalue and eigenvector)<br> end<br>//extracting components explored<br>X=X-t*p';//calculating the residual matrix<br>
<strong>T(:,j)=t(:,:);--THIS IS WHERE I AM GETTING THIS ERROR<br>P(:,j)=p(:,:);--THIS IS WHERE I AM GETTING THIS ERROR<br></strong>end<br>//T(:,j+1:numpcs)=[];<br>//P(:,j+1:numpcs)=[];<br>S=diag(T'*T);<br></div>
<div> </div>
<div>Very much appriciate any help,</div>
<div> </div>
<div>Kind regards,</div>
<div> </div>
<div>Tamas</div>