are you looking for something like this?
load("VolcRegion_clust.mat")
T = cell2table(VolcType_clust,"VariableNames",["Region","Cluster"]);
T.Region = categorical(T.Region)
T = 66×2 table
Region Cluster
______________________________ _______
Alaska 5
South America 2
Alaska 2
Alaska 2
Iceland and Arctic Ocean 2
Alaska 2
Alaska 2
Alaska 2
Alaska 2
Alaska 2
Alaska 2
Iceland and Arctic Ocean 10
Mediterranean and Western Asia 2
México and Central America 2
South America 2
South America 2
GS = groupsummary(T,["Region","Cluster"])
GS = 19×3 table
Region Cluster GroupCount
______________________________ _______ __________
Africa and Red Sea 2 3
Alaska 2 22
Alaska 5 1
Atlantic Ocean 2 2
Canada and Western USA 2 6
Canada and Western USA 5 1
Canada and Western USA 7 1
Iceland and Arctic Ocean 1 2
Iceland and Arctic Ocean 2 5
Iceland and Arctic Ocean 10 1
Mediterranean and Western Asia 2 2
México and Central America 2 1
México and Central America 9 1
South America 2 12
South America 3 1
South America 4 1
Data = unstack(GS,"GroupCount","Region");
Warning: Table variable names that were not valid MATLAB identifiers have been modified. Since table variable names must be unique, any table variable names that happened to match the new identifiers also have been modified.
To use the original INDVAR values as table variable names, set 'VariableNamingRule' to 'preserve'.
To use the original INDVAR values as table variable names, set 'VariableNamingRule' to 'preserve'.
Data = sortrows(Data,"Cluster")
Data = 10×9 table
Cluster AfricaAndRedSea Alaska AtlanticOcean CanadaAndWesternUSA IcelandAndArcticOcean MediterraneanAndWesternAsia M_xicoAndCentralAmerica SouthAmerica
_______ _______________ ______ _____________ ___________________ _____________________ ___________________________ _______________________ ____________
1 NaN NaN NaN NaN 2 NaN NaN NaN
2 3 22 2 6 5 2 1 12
3 NaN NaN NaN NaN NaN NaN NaN 1
4 NaN NaN NaN NaN NaN NaN NaN 1
5 NaN 1 NaN 1 NaN NaN NaN 2
6 NaN NaN NaN NaN NaN NaN NaN 1
7 NaN NaN NaN 1 NaN NaN NaN NaN
8 NaN NaN NaN NaN NaN NaN NaN 1
9 NaN NaN NaN NaN NaN NaN 1 NaN
10 NaN NaN NaN NaN 1 NaN NaN NaN
Labels = unique(VolcType_clust(:,1));
figure(1)
bar(categorical(Data.Cluster),Data{:,2:end},'stacked')
legend(Labels)