Clear Filters
Clear Filters

grouping values of 3 columns

2 views (last 30 days)
hello all, i have one question which is related to grouping columns. for instance:
data=[2 0 2; 0 0 0; 0 2 0; 0 0 12];
what i want are
202 as one row and one col
000 as one row and one col
020 as one row and one col
0012 as one row and one col

Accepted Answer

Michael Haderlein
Michael Haderlein on 8 May 2015
Not clear what you mean: Do you want a numeric array or a string? If it's numeric, there's no 020 but only 20. If you want string, you'll have to use cells. One possibility is:
ans =
If it's still numeric, you could do this:
ans =

More Answers (0)


Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!