Andrei,
Thank you very much for your answer but when I put it the new made L4 introduces a row with 0 between every rows. How can I eliminate this rows? And if the matrix change of size, Have I that change anythings?
L9 =
1 1 0 0
5 5 0 0
0 5 7 7
0 0 9 11
Lp = zeros(size(L9).*[2 1]); Lp(1:2:end) = L9; Lp = bwlabel(Lp')'; L9(L9~=0)=Lp(Lp~=0); Lp =
1 1 0 0
0 0 0 0
2 2 0 0
0 0 0 0
0 3 3 3
0 0 0 0
0 0 4 4
0 0 0 0

 Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 5 Nov 2011

0 votes

L4 = zeros(size(L9).*[2 1]);
L4(1:2:end) = L9;
L4 = bwlabel(L4')';
Lp = L4(any(L4,2),:);

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by