- using a loop
- replicating B in the third dimension to match the size of A
Change array elements that meet a condition - Multidimensional array case
7 views (last 30 days)
I can handle this in the case of two-dimensional arrays.
I have trouble in the case of multidimensional arrays. For example
I would like to change the value of all elements on each page of A this way
A=reshape(A, 4, 4, 2)
Is it possible to obtain that result without reshapes?
In general, how to handle conditions that apply only to some indexes in multidimensional arrays?
PS: A and B are very large data matrices.
Rik on 21 Jan 2022
I can think of two ways:
I suspect the first way would be faster, but I think that might depend on the sizes of the array and the physical memory.