From: Guangping Zhang on 9 Mar 2010 22:07 Dear all: For loop works well for cell array, but the nested for loop doesn't work. Where is wrong? I have two cells: c and cT. c contain 10 files with different size and cT contains 5 matrix, I will using parameters in c to fit my recording in cT. The trouble is that I can run an iteration below well, n=length(c{1}-1); decay=ones(n,3); for i=1:n k=c{1}(i,3); x=cT{1}(k:k+1000,1); Y=cT{1}(k:k+1000,2); tauY=@(p) p(1)+p(2)*exp((S.T1(k,1)-x)/p(3))-Y; tau=LMFnlsq(tauY, [2e-10;1e-11;0.01]); end But after I use nested iteration, it doesn't. I realize that the n dependent on j, it's a problem? or k need changed? how to do it? The warning is 'x=cT{j}(k:k+1000,1); Y=cT{j}(k:k+1000,2);'. I really don't know why. for j=1:5 n=length(c{j}-1); decay=ones(n,3); for i=1:n k=c{j}(i,3); x=cT{j}(k:k+1000,1); Y=cT{j}(k:k+1000,2); tauY=@(p) p(1)+p(2)*exp((S.T1(k,1)-x)/p(3))-Y; tau=LMFnlsq(tauY, [2e-10;1e-11;0.01]); end end Any help will be welcome.
|
Pages: 1 Prev: Can matlab write into the paradox database file? Next: how to construct an orthogonal matrix |