Can I rewrite 'summary' command for categorical variable?

I need the output of 'summary' command in table format. I tried to rewrite the 'summary' command codes in local copy of it but i have some error that does not let me use it. The error returns to 'subsref.m' function that has to parameters (subsref(a,s)), a is the categorical variable and s is a structure with the fields:
type -- string containing '()' specifying the subscript type.
Only parenthesis subscripting is allowed.
subs -- Cell array or string containing the actual subscripts.
Error reason is that s.type is .(dot) in my local copy named summaryFun!!
How can i fix it?

5 件のコメント

kiarash Dousti
kiarash Dousti 2016 年 3 月 28 日
I also used
tablesummary = evalc('summary(t1.Var15)');
But the output would be char array!!! If i could convert tablesummary to a table it would be fin too!!
Walter Roberson
Walter Roberson 2016 年 3 月 28 日
You could parse the result of the evalc(), potentially.
kiarash Dousti
kiarash Dousti 2016 年 3 月 28 日
編集済み: kiarash Dousti 2016 年 3 月 28 日
As you know tablesummary would be something like:
That is a 1-by-81 char!!
<=50K category has been seen 35352 times and >50K category has been seen 11158 times! I need this information in table.
Walter Roberson
Walter Roberson 2016 年 3 月 28 日
regexp(), strsplit(), sscanf() -- there are a lot of different ways to parse a char array.
kiarash Dousti
kiarash Dousti 2016 年 3 月 28 日
Tank you dear Walter I used strsplit() and the problem was solved

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2016 年 3 月 28 日

コメント済み:

2016 年 3 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by