Interpolate 1 array to another

조회 수: 4 (최근 30일)
Sarah Yun
Sarah Yun 2020년 1월 18일
답변: Akira Agata 2020년 1월 19일
Hello,
I want to interpolate a 5x9000 numeric array onto a 2000x3000 numeric array.
Other words, I want both arrays the same size.
What code is easiest for this?

답변 (2개)

Image Analyst
Image Analyst 2020년 1월 18일
If you have the Image Processsing Toolbox, use imresize():
array1NewSize = imresize(array1, size(array2));

Akira Agata
Akira Agata 2020년 1월 19일
If you don't have the Image Processing Toolbox, interp2 would be your friend, like:
% assuming array1 is a 5x9000 numeric array
[xGrid, yGrid] = meshgrid(linspace(0,1,9000),linspace(0,1,5));
[xGrid2, yGrid2] = meshgrid(linspace(0,1,3000),linspace(0,1,2000));
array1NewSize = interp2(xGrid,yGrid,array1,xGrid2,yGrid2);

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by