Help with updating for loop
Hi all,I have a problem with the following sample code:
M=[1 2 3 4 5 6 7 8 9 10]
for i=1:length(M)
M(i)=[]
end
My code is not complete, but my problem is that when one row is omitted from the matrix, the size reduces to 9, so the code gets stock with an error to find M(10). Actually, I want to update the cell size in for loop. In my code, I must make some rows empty, I can not keep them. ThanksHi all,I have a problem with the following sample code:
M=[1 2 3 4 5 6 7 8 9 10]
for i=1:length(M)
M(i)=[]
end
My code is not complete, but my problem is that when one row is omitted from the matrix, the size reduces to 9, so the code gets stock with an error to find M(10). Actually, I want to update the cell size in for loop. In my code, I must make some rows empty, I can not keep them. Thanks Hi all,I have a problem with the following sample code:
M=[1 2 3 4 5 6 7 8 9 10]
for i=1:length(M)
M(i)=[]
end
My code is not complete, but my problem is that when one row is omitted from the matrix, the size reduces to 9, so the code gets stock with an error to find M(10). Actually, I want to update the cell size in for loop. In my code, I must make some rows empty, I can not keep them. Thanks for loop MATLAB Answers — New Questions