Borrar filtros
Borrar filtros

Array in array in image??

2 visualizaciones (últimos 30 días)
Tanakorn Tiay
Tanakorn Tiay el 19 de Nov. de 2013
Comentada: Tanakorn Tiay el 20 de Nov. de 2013
I want array value not 0 keep to new array ?
r = img(:,:,1); g = img(:,:,2); b = img(:,:,3);
% double aa; double aa;
AR = [r];
[i,j] = size(AR);
for i = 1:j
if (AR(i) ~= 0)
aa = [AR(i)]
end
end

Respuesta aceptada

Jan
Jan el 19 de Nov. de 2013
To get the non-zero elements of an array simply do something like:
A = randn(100, 100);
A_non_zero = A( A~=0 );
This stores the non-zero elements of matrix A in the array A_non_zero.
  1 comentario
Tanakorn Tiay
Tanakorn Tiay el 20 de Nov. de 2013
thank you ^_^ ขอบคุณครับ

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by