Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 MATLAB 中有一个大型二维数组,它会随着时间的推移而更新。(类似于A = ( i , j , k ),其中k是时间)。
我想在时间k找到所有大于阈值的元素,并在时间k - 1替换它们的值。 没有for循环是否可能?
for
非常感谢。
尝试这个:
A = zeros(2,2,3); A(1,1,2) = -1; A(1,3,2) = 10; A(3,3,2) = 15; %% k = 2; thr = 0; [row,col,v] = ind2sub(size(A),find(A >thr)) A(row,col,k) = A(row,col,k-1) A(:,:, k)%display