필터 지우기
필터 지우기

taking special average of numbers

조회 수: 1 (최근 30일)
Neesha
Neesha 2014년 9월 12일
답변: Andrei Bobrov 2014년 9월 12일
I have two field in dataser as below.
the answer you see as C labeled row, is A1*B1 + A2*B2 + A3*B3 = weightedA A1 + A2 + A3 = totalA so C1 = weightedA/totalA
now do the same for next 3 numbers and so on.
How do i do that in matlab?

채택된 답변

Andrei Bobrov
Andrei Bobrov 2014년 9월 12일
ab = randi(100,2,12); % here ab - your array
ab2 = permute(reshape(ab,2,3,[]),[2 3 1]);
ab(3,3:3:end) = dot(ab2(:,:,1),ab2(:,:,2))./sum(ab2(:,:,1);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by