I am running simulations with 5 inputs and 4 outputs for 1000 iterations. The results are stored in a 1000x9 Matrix. Lets name this 'Results'. Each of the rows correspond to one iteration. The first 5 columns in each row correspond to the input values and the last four columns in each row are the ouputs.
I need to remove the rows from the matrix which have the same input conditions. So for any 2 rows, say i and j
Results(i,1)==Results(j,1) && Results(i,2)==Results(j,2) && Results(i,3)==Results(j,3) && Results(i,4)==Results(j,4) && Results(i,5)==Results(j,5)
I have to remove either row i or row j
I would appreciate any and all help :)

 採用された回答

Andrei Bobrov
Andrei Bobrov 2018 年 5 月 18 日

2 投票

[~,b,c] = unique(Results(:,1:5),'rows','stable');
out = Results(b(histcounts(c,1:numel(b)+1) == 1),:);

1 件のコメント

Ashley Andrew Filipe do Rego
Ashley Andrew Filipe do Rego 2018 年 5 月 21 日
Thanks Andrei! Worked perfectly :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB についてさらに検索

製品

リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by