display dataset showing full char entries

By default, the display function only explicitly displays character array entries in datasets if they have length 10 or less. Is there a way to override this to display character entries with arbitrary length?

 채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 19일

1 개 추천

Yes, you can construct your own routine named "display" and put it in your path. The routine will need to know how to format everything according to your tastes -- numeric arrays, cell arrays, structures, datasets, and so on.
And if you are saying to yourself, "That sounds pretty yucky!" then you would be correct. There is no (known) tunable parameter so all you can do is replace the display routine entirely.

댓글 수: 1

Peter Perkins
Peter Perkins 2012년 6월 19일
Peter, what Walter says is more or less correct, although perhaps a bit strong in this specific case. It is possible for you to modify the disp method for the dataset class and change 10 to whatever you want. "edit dataset/disp" will get you there. Of course, in your environment, you may not have the privileges to do that.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Peter Perkins
Peter Perkins 2012년 6월 19일

0 개 추천

Peter, you may find that using a cell array of strings rather than a char matrix gets you what you are looking for:
>> a = ['a ';'abcdefghij ';'abcdefghijklmnopqrstuvwxyz'];
>> b = cellstr(a);
>> x = randn(3,1);
>> dataset(a,b,x)
ans =
a b x
[1x26 char] 'a' 0.86217
[1x26 char] 'abcdefghij' 0.31877
[1x26 char] 'abcdefghijklmnopqrstuvwxyz' -1.3077

Community Treasure Hunt

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

Start Hunting!

Translated by