edit-counting the numbers

2 次查看(过去 30 天)
kash
kash 2012-1-25
I have some value in a dataset
raw=
>50K
>=50K
>50K ;
;
;
;
;
<=50K
A=sum( strcmp('>50K', raw) )
A2=sum( strcmp('<=50K', raw) )
BUT I GET A ,A2 as zero ,such that i have 32000 rows
  7 个评论
TAB
TAB 2012-1-25
I don't know what is "raw" and what is it's dimensions.
But try
A=sum(strcmp('>50K', raw{1}))
A2=sum(strcmp('<=50K', raw{1}))
Walter Roberson
Walter Roberson 2012-2-4
raw is the third output from an xlsread()

请先登录,再进行评论。

回答(1 个)

Sven Schoeberichts
Sven Schoeberichts 2012-1-25
I still don't know if you have strings in that dataset or values, but this should give you a starting point:
length( find( dataset == value ))

标签

Community Treasure Hunt

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

Start Hunting!

Translated by