plot - Matlab coneplot meshgrid error MATLAB:griddedInterpolant:NdgridNotMeshgrid3DErrId / not plotting anythin -
basically want plot 3d vector field using coneplot in matlab. script looks this:
data=oommf2matlab('420x350x5-2_5-5.omf'); x=linspace(data.xmin,data.xmax,data.xnodes); y=linspace(data.ymin,data.ymax,data.ynodes); z=linspace(data.zmin,data.zmax,data.znodes); [x,y,z]=meshgrid(y,x,z); scale=4; angle = data.datay ./ data.datax; colors = angle; figure; coneplot(data.positionx,data.positiony,data.positionz,data.datax,data.datay,data.dataz,x,y,z,scale,colors);
oommf2matlab function converting data matlab , returns structure this:
xmin: 0 ymin: 0 zmin: 0 xmax: 4.2400e-07 ymax: 3.5400e-07 zmax: 1.2500e-08 xnodes: 212 ynodes: 177 znodes: 5 datax: [212x177x5 double] datay: [212x177x5 double] dataz: [212x177x5 double] positionx: [212x177x5 double] positiony: [212x177x5 double] positionz: [212x177x5 double]
running script gives me error
error using interp3 (line 146) input grid not valid meshgrid.
error in coneplot (line 144) ui = interp3(x,y,z,u,cx,cy,cz,method);
error in omf2cone (line 11) coneplot(data.positionx,data.positiony,data.positionz,data.datax,data.datay,data.dataz,x,y,z,scale,colors);
if traced error via debugging matlab:griddedinterpolant:ndgridnotmeshgrid3derrid error looks this:
identifier: 'matlab:griddedinterpolant:ndgridnotmeshgrid3derrid' message: data in meshgrid format, ndgrid format required. convert data follows: p = [2 1 3]; x = permute(x, p); y = permute(y, p); z = permute(z, p); v = permute(v, p); f = griddedinterpolant(x,y,z,v) cause: {0x1 cell} stack: [3x1 struct]
this strange me, because interp3 error suggests fix.
also if let coneplot generate mesh via:
coneplot(data.datax,data.datay,data.dataz,x,y,z,scale,colors);
there no error, there no plot created whatsoever, axis of figure.
instead of using meshgrid
use griddedinterpolant()
instead data in format identified in error.
also part of error in line [x,y,z]=meshgrid(y,x,z);
instead want [x,y,z]=meshgrid(x,y,z);
? cause syntax error describing
Comments
Post a Comment