Error: subscripted assignment dimension mismatch during convolution.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shounak Shastri
el 27 de Abr. de 2014
Respondida: aichouche farouk
el 27 de Nov. de 2017
I am writing a code for convolution of rows of a 256x256 matrix with a column vector consisting entirely of ones. But I am getting the error "subscripted assignment dimension mismatch" every time i run the code. Any suggestions ?
for k=1:255
for l=1:k
m(:,l) =conv((hkl(l,:))',ones(l,1));
end
end
'hkl' is the 256x256 matrix. I want convolve each row of hkl with a column vector of 1s whose length is equal to 'l' and store it in 'm'.
0 comentarios
Respuesta aceptada
Image Analyst
el 27 de Abr. de 2014
Not sure where you came up with that strange process. To convolve a 2D array with a column vector of l elements (which is an absolutely horrible variable name by the way), simply do this:
m = conv2(double(hkl), ones(l, 1), 'same');
In ones(), the first element is lower case L and the second argument is "one" in case you can't tell (which is why l is a terrible name). Be aware that if the sum of the l values exceeds 255, you can't get a uint8 image, which is perhaps what you were starting with, without clipping.
0 comentarios
Más respuestas (1)
aichouche farouk
el 27 de Nov. de 2017
for k=1:(i-1) if rem(k*dt,0.5)== 0 count =count+1; table(count,:)=[time(k) QX(k) FMA(k) FMR(k) SND(k) SNH(k) SNO (k) SS (k) XBA(k) XBH(k) XI (k) XND(k) XP(k) XS(k)]; end end
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!