error CAT arguments dimensions are not consistent.

1 visualizzazione (ultimi 30 giorni)
i have following code
genedata=[1:1:100]
IDX = kmeans(genedata',20)
for i = 1:20
genenum(i) = sum(IDX == i);
end
genes = cell(20,1);
for K = 1 : 20
genes{K} = genedata(IDX==K);
end
if i perform
final=[j genenum genes1]
i get that error
Error using ==> horzcat CAT arguments dimensions are not consistent
where j=[1:20]'
please help

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 21 Nov 2011
genedata=1:100;
IDX = kmeans(genedata',20);
genenum = cell(20,1);
for i = 1:20
genenum{i} = sum(IDX == i);
end
genes = cell(20,1);
for K = 1 : 20
genes{K} = genedata(IDX==K);
end
final=[num2cell((1:20)') genenum genes];
variant 2
genedata=1:100;
IDX = kmeans(genedata,20);
genenum = histc(IDX,1:20);
genes = [(1:20)', genenum, zeros(20,max(genenum))];
for i1 = 1:20
c = genedata(IDX==i1);
genes(i1,3 + (0:numel(c)-1)) = c;
end
  7 Commenti
Jan
Jan il 21 Nov 2011
I've found table 7, but I do not see a connection to the question about continuity.
FIR
FIR il 21 Nov 2011
ok jan ten can u tell how to form that table 7 plz

Accedi per commentare.

Più risposte (1)

lama riad
lama riad il 27 Feb 2012
I have this code n when I'm trying to imshow R1_F2 but i'm getting this error ??? Error using ==> vertcat CAT arguments dimensions are not consistent.
Error in ==> imrotate at 129 rotate = maketform('affine',[ cos(phi) sin(phi) 0; ...
Error in ==> just_4_me at 73 R1 = imrotate(I4, -Theta, 'nearest', 'crop'); ----------------------------------------------------------
here is the code:
% Load first image (I1)
I1 = imread('cameraman.jpg');
[SizeX SizeY]=size(I1);
% rotate the image
deg = 5;
I2 = imrotate(I1, deg, 'bilinear', 'crop');
% resize the image(scale)
cb=imresize(I2,0.7,'bicubic');
% translate the imaged
xform = [ 1 0 0;0 1 0;20 20 1 ];
tform_translate = maketform('affine',xform);
I4 = imtransform(cb, tform_translate,...
'XData', [1 (size(cb,2)+xform(3,1))],...
'YData', [1 (size(cb,1)+xform(3,2))],'FillValues',255);
% ---------------------------------------------------------------------
% Convert both to FFT, centering on zero frequency component
FA = fftshift(fft2(I1));
FB = fftshift(fft2(I4));
% ---------------------------------------------------------------------
% Convolve the magnitude of the FFT with a high pass filter)
H = hipass_filter(512,512).*FA;
H_second = hipass_filter(379,379).*FB;
% Transform the high passed FFT phase to Log Polar space
L1= transformImage(H, SizeX, SizeY, SizeX, SizeY, 'nearest', size(H)/ 2, 'valid');
L2 = transformImage(H_second, SizeX, SizeY, SizeX, SizeY, 'nearest', size(H_second) / 2, 'valid');
% Convert log polar magnitude spectrum to FFT
THETA_F1 = fft2(L1);
THETA_F2 = fft2(L2);
% Compute cross power spectrum of F1 and F2
i=sqrt(-1);
a1 = angle(THETA_F1);
a2 = angle(THETA_F2);
THETA_CROSS = exp(i * (a1 - a2));
THETA_PHASE = real(ifft2(THETA_CROSS));
% Find the peak of the phase correlation
THETA_SORTED = sort(THETA_PHASE(:));
SI = length(THETA_SORTED):-1:length(THETA_SORTED);
[THETA_X, THETA_Y] = find(THETA_PHASE == THETA_SORTED(SI));
% Compute angle of rotation
DPP = 360 / size(THETA_PHASE, 2);
Theta = DPP * (THETA_Y - 1);
% Rotate image back by theta and theta + 180
R1 = imrotate(I4, -Theta, 'nearest', 'crop');
R2 = imrotate(I4,-(Theta + 180), 'nearest', 'crop');
% Output (R1, R2)
% Take FFT of R1
R1_F2 = fftshift(fft2(R1));
imshow(R1_F2)
  1 Commento
Jan
Jan il 27 Feb 2012
This question has no connection to the original post. Please open a new thread and delete this _answer_.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by