Info

此问题已关闭。 请重新打开它进行编辑或回答。

Fltering to subsets of matrices

1 次查看(过去 30 天)
David
David 2012-5-4
关闭: MATLAB Answer Bot 2021-8-20
both Excel and Sql can 'query' and run functions on subsets of data based on common lable fields (e.g. return all sales in GA)
sum if 'GA' or count if 'GA'
Does Matlab have similare functionality?
  1 个评论
Sean de Wolski
Sean de Wolski 2012-5-4
Please provide a small example (inputs/ops/expected outputs).

回答(1 个)

per isakson
per isakson 2012-5-4
Yes!
sum( MyData( strcmp( MyData( :, ixColumn ), 'GA' ), : ), 1 )
This question is very close to Summing values with database "group by" functionality. It is a better tactic to provide a toy example than repeating the question! Didn't the answers to you other question help you?
  2 个评论
David
David 2012-5-22
Sorry, but I was not successful using the previous answer and I assumed it was because of the way I framed my question - which is why I tried to improve my question.

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by