MATLAB Answers


Matrix manipulation in three numbers

Tino 님이 질문을 제출함. 22 May 2019
최근 활동 James Tursa 님이 댓글을 추가함. 22 May 2019
Please I have 2 numbers in a column that does the same function below
croppedz = z(1:end-mod(end, 2*K), :); %ensure that height of J is a multiple of 2*K by removing extra elements from the end
result = zeros(size(croppedz, 1) / 2 / K, size(croppedz, 2)); %preallocate result
for col = 1:size(croppedz, 2) %loop over the columns. You can't do this without a loop due to the requirement to sort each columns separately
result(:, col) = sum(reshape(sort(croppedz(1:2:end, col)), K, []), 1) ./ sum(reshape(sort(croppedz(2:2:end, col)), K, []), 1); %sort even/odd rows, reshape each into a Kx? matrix, sum across rows and divide the two sums
I want to make it 3 numbers instead of two numbers various K as mentioned above for 2 numbers
Kindly get back

  댓글 수: 2

I think we need examples
(Tino's Answer moved here)
Thanks Walter
for instance I have the following matrices
1 C1
2 C2
2 C1
3 C2
4 C1
5 C2
3 C1
. .
. .
n C3
a matrix that can sort the numbers from lowest to highest and divide from the lowest first three numbers
Lower for k = 3 after sorting
K = C1 + C1+ C1/ C2 + C2 + C2
then down the sorted below when the list is not divisible by 3 it stops at the last number
Hope this is clearer

로그인 to comment.





답변 수: 0

Translated by