How to speed up matrix update zeros by using previous value?
이전 댓글 표시
Hello,
I am looking for the way to update my matrix zero values by using previous value. For example if c matrix is:
0 1 5 2 3 9 0
1 0 5 0 0 7 0
0 0 0 1 7 8 9
7 2 1 0 0 0 7
The result should look like this:
1 1 5 2 3 9 9
1 1 5 2 3 7 9
1 1 5 1 7 8 9
7 2 1 1 7 8 7
Now I use the following code:
c(c == 0) = NaN;
c = fillmissing(c,'previous');
c = fillmissing(c,'nearest',1);
However I use quite big matrixes like 10000000x150 and it takes very long to process, maybe somebody knows of a way to speed up this?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Vector Volume Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!