This question is related to this. Consider an array array1array
as
array = ImageData[RandomImage[10, 10]];
And the indices of the desired values are
desired = {{1, 3}, {1, 4}, {1, 5}, {1, 6}, {2, 3}, {2, 4}, {2, 5}, {2, 6},
{3, 3}, {3, 4}, {3, 5}, {3, 6}, {4, 3}, {4, 4}, {4, 5}, {4, 6}, {5,
2}, {5, 3}, {5, 4}, {5, 5}, {5, 6}, {6, 2}, {6, 3}, {6, 4}, {6,
5}, {6, 6}, {7, 3}, {7, 4}, {7, 5}, {7, 6}, {8, 3}, {8, 4}, {8,
5}, {8, 6}};
The desired values can be found (following the answer to the earlier question) through
val = Extract[array,desired];
Now I have another array array2
of same dimensions of array1
and I wish to assign the values in val
to the desired postions desired
of array2
.
I tried the following one:
array2[[##]] & @@@ desired = val;
However, this does not work.
How can I do this?