Clear Filters
Clear Filters

How to solve "Transpose on ND array is not defined. Use PERMUTE instead."

3 views (last 30 days)
lena = double(imread('lena.tif'));
figure(6);
imshow(lena)
y_LenaHalf = double(imread('lena_half.tif'));
figure(7);
imshow(y_LenaHalf)
x2 = 1:256;
xi_2 = 1:(255/511):256;
yi_2 = interp1(x2, y_LenaHalf, xi_2);
yi2_2 = interp1(x2, yi_2.', xi_2).';
figure(8);
imshow(uint8(yi2_2))
SE2 = (lena - yi2_2).^2;
MSE2 = mean(mean(SE2));
I want to enlarge photo 'lena' using interp1, but i got an issue.
Error using .' Transpose on ND array is not defined. Use PERMUTE instead.
Error in week9_lectorial (line 44) yi2_2 = interp1(x2, yi_2.', xi_2).';

Answers (1)

KSSV
KSSV on 22 May 2018
A = rand(2,3,3) ;
A' % throws error
So, you cannot transpose a 3D matrix, striaght away. Check this:
[m,n,p] = size(A) ;
iwant = zeros(n,m,p) ;
for i = 1:p
iwant(:,:,i) = A(:,:,i)' ;
end

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!