create a grid fuction
3 次查看(过去 30 天)
显示 更早的评论
I wanna write a function .mfile to create a computational grid.
function kgrid = test_environment
Nx = 10;
Ny = 10;
Nz = 10;
dx = 0.001;
dy = 0.001;
dz = 0.001;
kgrid = test_environment (Nx, dx, Ny, dy, Nz, dz);
why do i get this error: Too many input arguments.????
0 个评论
回答(3 个)
Iain
2013-5-29
It is because in your function declaration, you do not define inputs.
function kgrid = test_environment(nx,dx,ny,dy,nz,dz)
Lets you input those parameters.
Look at the help on varargin and nargin if you want optional arguments.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!