필터 지우기
필터 지우기

Is there a faster way of updating elements in a big matrix?

조회 수: 2 (최근 30일)
Chaoyang Jiang
Chaoyang Jiang 2018년 7월 5일
댓글: dpb 2018년 7월 5일
Is there a faster way of updating elements in a big matrix?
Currently, I have A with a size of 9000000*8760. Each loop I need to update some elements, like: B=randi(800000,10000,1); A(B,:)=5;
Is there a faster way of dealing with big data?
Thank you.
  댓글 수: 1
dpb
dpb 2018년 7월 5일
Until run profiler to know where are slow spots specifically any micro optimization is premature.
W/o other information on code structure nothing to be said;
A(B,:)=5;
is about as efficient as it gets presuming elements of B are already in A which is a class double array...the hint may be in the earlier phrase of "Each loop...". Perhaps that loop or significant portions could be vectorized or otherwise are the bottleneck but crystal ball is in shop for repair (yet again)...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by