Sum the values of one column based on another column in Table
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello , I am new with Matlab and i need help with this Problem .
I have Table of 4 columns and i want to sum the Values in the first column which are corresponds to the similar Values in the second Column.
for example depend on the table below i want to for Range = 862.33 ---> count total = 15
and i do not want it specific for one table , the values in the table can be changed
thank you in advance
Count Range Mean Start End
_____ ______ ______ _____ _____
1 862.33 579.3 168 334
1 862.33 579.3 668 834
1 862.33 579.31 1334 1501
1 864.55 580.42 1168 1668
1 862.33 579.3 2168 2334
1 1012.7 506.35 1834 2001
1 1012.7 506.35 501 1001
1 862.33 579.3 2668 2834
1 862.33 579.31 3501 3668
1 864.55 580.42 3168 3334
1 862.33 579.3 4168 4334
1 1012.7 506.35 3834 4001
1 1012.7 506.35 2501 3001
1 862.33 579.3 4668 4834
1 862.33 579.31 5334 5501
1 864.55 580.42 5168 5668
1 1012.7 506.35 5001 5834
1 862.33 579.3 6168 6334
1 1012.7 506.35 4501 6001
1 862.33 579.3 6668 6834
1 862.33 579.31 7334 7501
1 864.55 580.42 7168 7668
1 862.33 579.3 8168 8334
1 1012.7 506.35 7834 8001
1 1012.7 506.35 6501 7001
1 862.33 579.3 8668 8834
1 862.33 579.31 9334 9501
1 864.55 580.42 9168 9668
0.5 1012.7 506.35 1 8501
0.5 1012.7 506.36 8501 9001
0.5 1012.7 506.35 9001 9834
0.5 1012.7 506.36 9834 10001
0 comentarios
Respuestas (1)
KSSV
el 9 de Ag. de 2020
Let T be your table.
R = T.Range ;
val = 862.33 ;
count = nnz(abs(R-val)<=10^-5)
2 comentarios
KSSV
el 9 de Ag. de 2020
May be you are looking for:
R = T.Range ;
[val,ia,ib= = unique ;
N = length(val) ;
count = zeros(N,1) ;
for i = 1:N
count(i) = nnz(abs(R-val(i))<=10^-5);
end
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!