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.
我有一个 3D 矩阵: size(data) = [100, 3, 500] 我想用 1 替换第一列中的所有 -1。然后,我想用 0 替换第二列和第三列中的所有 -1。
线性索引似乎不起作用,因为我还必须替换第二列和第三列。
你不能这样做:
col1 = data(:,1,:); col1(col1 == -1) = 1; data(:,1,:) = col1;
ETC...?