Calculating the strangeness using k constant
조회 수: 1 (최근 30일)
이전 댓글 표시
A B
_______ __
0.57446 C1
0.61644 C2
0.93808 C1
2.1817 C2
2.9883 C1
3.1654 C2
if I want to do this calculations such divide all the sums of C1 by all the sums of C2 how do I go about it. using a constant suck as K to determine the number to sum.
for instance if k = 2
strangeness = sum of the smallest 2 numbers of c1/ sum of the smallest 2 numbers of c2
if K = 3
strangeness = sum of the smallest 3 numbers of c1/sum of the smallest 3 numbers of C2
Thanks in advance
Jonathan
댓글 수: 0
답변 (1개)
Stephen23
2019년 4월 10일
>> a = [0.6164;3.1654;0.5745;2.9883;0.9381;2.1817];
>> c1 = sort(a(1:2:end));
>> c2 = sort(a(2:2:end));
>> K = 2;
>> sum(c1(1:K))/sum(c2(1:K))
ans = 0.23035
댓글 수: 2
Stephen23
2019년 4월 10일
Jonathan Etumusei's "Answer" moved here:
Hi Stephen thanks for your swift response
>> c1 = sort(totalY11(1:2:end));
I am getting the error
Subscripting a table using linear indexing (one subscript) or multidimensional indexing (three or more subscripts) is not supported. Use a row subscript and a variable subscript.
How do I go about it
Thanks in advance
sorry got it sorted was because the table is in the form
A B
_______ __
0.57446 C1
0.61644 C2
0.93808 C1
2.1817 C2
2.9883 C1
3.1654 C2
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!