how many times is a value repeated in a table
2 ビュー (過去 30 日間)
古いコメントを表示
Fedi Chaarana
2021 年 7 月 14 日
回答済み: Sulaymon Eshkabilov
2021 年 7 月 14 日
Hello
I have a mdf4 datei that i read with matlab and was converted into timetable. I converted this timetable to a normal table and i want to analyse the values of the first row. Each values was taken after 0,1s so and are one of these following possibilities{20,50,100} with some tolerance.
My question: how can i create a loop that tells me for how many times a values is repeated on the table ?
thanks in advance
0 件のコメント
採用された回答
Sulaymon Eshkabilov
2021 年 7 月 14 日
N20=sum(tab.prob(:,1)==20); % Times of 20s
N50=sum(tab.prob(:,1)==50); % Times of 50s
N100=sum(tab.prob(:,1)==100); % Times of 100s
0 件のコメント
その他の回答 (1 件)
Ive J
2021 年 7 月 14 日
You can play with groupSummary which offers lots of options:
tab = table(repmat([20; 50; 100], 20, 1), string((1:60).'), 'VariableNames', {'prob', 'id'});
head(tab)
tabSum = groupsummary(tab, 'prob')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!