Removing duplicate rows of matrices from a cell array.

I have a 32x32 cell array which all either contain X,Y coordinates or are empty (I have attached an image of the array to give an example of it's structure).
The top row is identical to rows 2:10, the 11th row is the same as rows 12 & 13, the 14th row is the same as rows 15:19 etc...
I want to sort the cell array so instead of a 32x32, it becomes a 6x32 (in this case; there won't always be 6 unique rows) where each row is unique.
Any help would be greatly appreciated; please let me know if any additional info is required.

 採用された回答

steven
steven 2016 年 11 月 3 日

0 投票

Managed to solve it myself (with a lot of fiddling around!):
Where 'a' is the 32x32 cell array:
RemoveIndex = [];
for i=1:size(a,1)-1
for j=1:length(a)
if ~isempty(a{i,j}) && ~isempty(a{i+1,j})
if (a{i,j})-(a{i+1,j})==0
RemoveIndex = [RemoveIndex,i+1];
end
end
end
end
RemoveIndex = unique(RemoveIndex)
b=a;
b(RemoveIndex,:)=[];

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

製品

質問済み:

2016 年 11 月 3 日

回答済み:

2016 年 11 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by