Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

(R2010a) INTERP3 vertcat error, CAT arguments dimensions are not consistent.

1 visualización (últimos 30 días)
Adam
Adam el 27 de Mayo de 2014
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi all, when I was trying to use CONEPLOT function I got this error in an inner INTERP3 function:
??? Error using ==> vertcat CAT arguments dimensions are not consistent.
Error in ==> interp3 at 204
[~,i] = sort([zz;zzi]);
Error in ==> slice at 104
vi = interp3(x,y,z,v,xi,yi,zi,method);
The strange thing was that it worked for some specific combination of CONEPLOT input arguments, so this error showed up only for certain sizes of input arguments.
I tried to trace the problem and seems to solved it by "repairing" following line in a INTERP3 code.
INTERP3.m > original line 149:
xx = x(1,:,1).'; yy = y(:,1,1); zz = squeeze(z(1,1,:)); % columns
It seems that in this case the SQUEEZE function returns a row vector (1xN) zz while xx and yy are column vectors (Nx1), which cause this error in above-mentioned line 204.
Don't know if the main problem is somewhere else, I "repair" it by adding .' after SQUEEZE function
zz = squeeze(z(1,1,:)).';
As I mentioned in the title, I'm using MATLAB R2010a, I didn't test it for any other versions. However, it is possible that this "correction" cause more problems than benefits :-)
Have someone been faced with this problem? Could you test it?
Hope it helps...
Thanks, Adam
PS: I use the CONEPLOT function according to the example described in the Help (coneplot). The problem has happened for certain combination of input matrix sizes...
  3 comentarios
Adam
Adam el 27 de Mayo de 2014
Hi Mahdi, for
coneplot(Xi,Yi,Zi,u,v,w,cx,cy,cz)
where
Xi,Yi,Zi,u,v,w ... (17x17x17)
cx,cy,cz ... (10x10x10)
therefore, line 143 (in coneplot.m)
interp3(x,y,z,u,cx,cy,cz,method);
where
x,y,z ... (17x17x17)
cx,cy,cz ... (1000x1)
works perfectly. If I change the (17x17x17) matrices to e.g. (19x19x19) then it is not working and error will show up.
I trace the INTERP3 code and it goes different way for these two sizes of input matrices.
Problematic is the line 204 (interp3.m) for the latter case. The former one (17x17x17) do not pass this line.
Thanks, Adam.
Adam
Adam el 27 de Mayo de 2014
Looks like that line 154 (in interp3.m) decides to pass the part of the code starting at line 176 (Bypass mapping code for cubic). It passes this part for 19x19x19 (in my alghoritm) resulting in the error, but it skips this part in case of 17x17x17 matrices.
So the line 154 decides based on the actual value of data... Not sure if it works correctly for regular grid and linear interpolating.

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by