rows and columns in array
显示 更早的评论
Say I have an array with x amount of rows and 3 columns.
I want to count how many times does a specifc value repeat on the first column. So for example I want to know how many times do numbers 5,6,7,8,9 repeat in the first column. If they repeat less than 4 times then I want to delete the entire row where that value is in the first and/or second column to be deleted.
example: 5 has less than 4 combinations then the following rows would be deleted from the array.
5 1 100
2 5 800
5 5 500
1 个评论
Image Analyst
2020-12-3
Well fine, but you didn't show us the original matrix with the repeats and the "rows to be removed" in that matrix. What does your original matrix look like? and do you want 5,6,7,8,9 in order and that whole stretch of 5 adjacent numbers is repeated more or less than 4 times? Or do you want to delete rows where 5 is less than 4 times, and 6 is less than 4 times, etc.? The meantime, see ismember(), sum(), etc. And does repeated mean adjacent repeats, like [1,4,4,4,4,5,6] or can the repeat be separated, like [1,4,3,4,6,4,7,4]?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!