Problem Using groupsummary function
Show older comments
Hi, I'm trying to count how many times a coordinate (x,y) repeats in a file. I'm using this code:
SBc='sb-noH_2R401_Coord.gtxt'; % Nombre del archivo a abrir
SBIDc = fopen(SBc); % Abre el archivo
cell = textscan(SBIDc,' % f %f'); %Escanea la información del archivo y la almacena en una 'célula'.
fclose(SBIDc);
mc=cell2mat(cell); % convierte la celula en matriz
table1=table(mc(:,1)); % convierte a tabla la info
table2=table(mc(:,2));
zt=table(table1,table2,'VariableNames',{'xc','yc'});
count=groupsummary(zt,{'xc','yc'})
And, I'm getting this error:
Error using matlab.internal.math.grp2idx (line 172)
A grouping variable of class 'table' is not supported.
Error in matlab.internal.math.mgrp2idx (line 93)
[g,countgrp(j),gd{1,j}] = matlab.internal.math.grp2idx(group{1,j},inclnan,inclempty);
Error in groupsummary (line 385)
[gvidx,numgroups,gdata,gcount] = matlab.internal.math.mgrp2idx(groupingdata,size(T,1),inclnan,inclempty);
Any idea what I'm doing wrong?
I did all this once and I got it right, now I don't understand why it's not working
Thank you
1 Comment
darova
on 15 Apr 2020
What about this?

Accepted Answer
More Answers (0)
Categories
Find more on Tables 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!