Borrar filtros
Borrar filtros

Excluding NaNs in resize

14 visualizaciones (últimos 30 días)
SuzieChan
SuzieChan el 22 de Abr. de 2020
Comentada: KSSV el 22 de Abr. de 2020
Hi
I want to resize 2 arrays, A and B, to make them the same size.
BUT, array B has a lot of NaN value.
So, I only want to resize A to fit the numerical data in B, excluding the NaN values.
% The CODE to resize
C = imresize(A, size(B));
% How can I modify the size(B) part to exclude the NaN during the resize process?

Respuestas (1)

KSSV
KSSV el 22 de Abr. de 2020
You can fill the NaN's using fillmissing. And then use resize the way you want.
You can use interp2 to get them to the same size.
  5 comentarios
SuzieChan
SuzieChan el 22 de Abr. de 2020
Editada: SuzieChan el 22 de Abr. de 2020
I could convert the NaN to 0 and maybe there is some code to ignore the 0 when doing the imresize?
KSSV
KSSV el 22 de Abr. de 2020
Remove rows and columns with NaN.
A(all(isnan(A),2),:) = [] ; % remove in NaN's rows
A(all(:,isnan(A),1)) = [] ; % remove rows in columns

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by