Help Storing Values in a Matrix For Loop
Show older comments
I know this questions has been asked numerous times, but I haven't found an answer for this case. It is hard to explain so, I will put the code in to hopefully help better understand the problem.
red_matrix=zeros(5)
for ii=2
matrix_sort=sort(time(:))
n=[2:25]
min_t(ii)=matrix_sort(n(ii));%new min t after initialization
[row(ii),col(ii)]=find(time==min_t(ii));%finding block address
red_matrix(row(ii),col(ii))=1
so after every loop, there is a different column and row that needs to be replaced with a "1" in the red_matrix. The problem is, that I need to keep the old 1 value also. I've tried everything I can think of but it keeps resetting the matrix after every loop.
Answers (0)
Categories
Find more on Loops and Conditional Statements 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!