필터 지우기
필터 지우기

Calculate a return

조회 수: 1 (최근 30일)
Cameron
Cameron 2011년 12월 9일
Hi,
I am trying to calculate a return based on two arrays, mval and mvalprevday.
When I calculate a return as per the below formula my results return a lot of zeros. So I think Matlab is calculating a return for each possible combination of numbers.
Does anyone know how I can avoid getting many zeros. I basically think if I can tell Matlab to only calculate one result per row (I.e. column 1 in mval array * column 1 in mvalprevday array
rtn = mval / mvalprevday
rtn =
Columns 1 through 8
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0

답변 (2개)

Walter Roberson
Walter Roberson 2011년 12월 9일
rtn = mval ./ mvalprevday
Notice the period before the /

Cameron
Cameron 2011년 12월 10일
Perfect. Thanks!

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by