How to choose identical values in a cell array with constraints using Matlab?
问题 If I have a 4x1 Cell structure with that represents a=[A1 A2 A3 A4] : a=cell(4,1) a{1}=[1 3 1 0] a{2}=[3 3 3 3] a{3}=[3 2 3 2] a{4}=[3 3 3 2] B=[1 1 1 2]; %priority I would like to do the following : Pick cells that correspond to priority B=[1 1 1 2] (where B=1 is highest priority and A=3 ) Which means, find any cell that begins with [3 3 3 #], where all their priority is 1's in B . ideal answer should be : a{2} = [3 3 3 3] and a{4} = [3,3,3,2] My try is to add this : [P arrayind]=min(B) %