How can i changethe value at a position in an array
1 view (last 30 days)
Star Strider on 20 Jun 2021
The ‘k’ array is a (201x201) array of zeros. The code likely works correctly, however using a single index into an array uses linear indexing. To understand the row and column assignments for element 101 and 201, use the ind2sub function:
k = zeros(201)
[r1,c1] = ind2sub(size(k), 101)
[r2,c2] = ind2sub(size(k), 201)
See the documentation on Matrix Indexing for details. .