error CAT arguments dimensions are not consistent.

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

 Accepted Answer

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 Comments

andrei i am getting same error
genes consists of
[1x4 double]
[1x5 double].............
how to display these in matrix form
ans please suggest who to rectify that error
see "final" in Variable Editor
error??
see
http://imageshack.us/photo/my-images/405/forfir.png/
THANKS A LOT ANDREI I AM GREATFUL TO U ....one question my professor asking me is ,why those values are contionous
for ex...1,2,3,4,5,6,7
8,9,10,11,12,13,14
i have atached a pdf ,please see see table7,page num12
http://www.sendspace.com/file/29youd
I've found table 7, but I do not see a connection to the question about continuity.
ok jan ten can u tell how to form that table 7 plz

Sign in to comment.

More Answers (1)

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 Comment

This question has no connection to the original post. Please open a new thread and delete this _answer_.

Sign in to comment.

Categories

Find more on Graph and Network Algorithms 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!