Hello!
As per my understanding, you want to group the rows of your table using the variables ‘Lot’ and ‘Ratio’ and then, get the sum of the variable ‘Net’. I think a good solution to this would be using the ‘findgroups’ function to group the variables and then, calling ‘splitapply’ to get the sum. The code looks something like this:
G=findgroups(ex.Lot,ex.Ratio)
netsum=splitapply(@sum,ex.Net,G)
However, the rows would have to be sorted when using this, so you can use ‘sortrows’ for this.
You may refer to the following documentation links for:
- Findgroups: https://www.mathworks.com/help/matlab/ref/findgroups.html#bux3dup
- Splitapply: https://www.mathworks.com/help/matlab/ref/splitapply.html#bux2_9d
- Sortrows: https://www.mathworks.com/help/matlab/ref/double.sortrows.html#bt8bz9j-5
Hope this helps!