Going nuts with cell array, because I just can't get rid of it... However, it will be an easy one for you guys out here.
So here is why: I have a dataset (data) which contains two variables: A (Numbers) and B (cell array). Unfortunately I can't even reconstruct the problem nevertheless my imported table looks like this:
data=dataset;
data.A = [1;1;3;3;3];
data.B = ['A';'A';'BUU';'BUU';'A'];
where data.B is of the type 5x1 cell which I can't reconstruct
all I want now is the unique rows like
ans= [1 A;3 BUU;3 A] the result should be in a dataset or just two vectors where the rows are equivalent.
but unique([dataA dataB],'rows') can't handle cell arrays and I can't find anywhere in the www how I simple convert the cell array B to a vector of strings (does it exist?).
cell2mat() didn't work for me, because of the different word length ('A' vs 'BUU').
Though, two things I would love to learn: Making an 5x1 cell to an string vector and find unique rows out of numbers and strings (or cells).
Thank you very much!
Cheers Dominik
data.B
is a 5x1 cell array, So the line that definesdata.B
should have{}
instead of[]
, right? – Luis Mendo