tresholding by summing over a dimension of a matrix
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am trying to treshold data by summing over elemtns in the third dimension of a matrix and if the sum of all elements in a row of the third dimension is larger than a treshold value, all that row is set to NaN. However, I think the code I wrote must not be doing what I think it is since it is taking a very long time to compile.
Could you help me write some code please?
for c = 1:200000
for b = 1:32
for a= 1:32
if sum(micron_62frames(a,b,:),3) > 200000*65
micron_62frames(a,b,:) = NaN;
elseif sum(micron_62frames(a,b,:),3) < 200000*65
micron_62frames(a,b,:) = micron_62frames(a,b,:);
end
end
end
end
2 件のコメント
David Goodmanson
2019 年 11 月 25 日
Also the elseif statement and the command that goes with it is unneccesary, since all you are doing with
micron_62frames(a,b,:) = micron_62frames(a,b,:)
is setting a bunch of stuff equal to what it is already.
回答 (1 件)
Andrei Bobrov
2019 年 11 月 27 日
k = size(micron_62frames,3);
lo = sum(micron_62frames,3) > 13e6;
micron_62frames(repmat(lo,1,1,k)) = nan;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!