find a rows in matrix and its position in that matrix ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MUKESH KUMAR
am 22 Nov. 2017
Kommentiert: MUKESH KUMAR
am 12 Dez. 2017
datasheet(48*6)size
%I had a matrix of size(48*6) and then
ii = randperm(size(datasheet,1));
k = ones(24,1)*2;
out = mat2cell(datasheet(ii(1:sum(k)),:),k,size(datasheet,2));
%then i select a row from datasheet lets say 4th row
B=datasheet(4,:);
%now I want to find out the position of that 4th row in "out" matrix.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Andrei Bobrov
am 22 Nov. 2017
Bearbeitet: Andrei Bobrov
am 22 Nov. 2017
In general case:
[~,ji] = cellfun(@(x)ismember(B,x,'rows'),out,'un',0);
jj_cell = find(cellfun(@(x)x>0,ji));
ii_row_in_cell = ji{jj_cell};
0 Kommentare
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!