create a grid fuction

1 回表示 (過去 30 日間)
sia
sia 2013 年 5 月 29 日
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.????

回答 (3 件)

Iain
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.
  2 件のコメント
sia
sia 2013 年 5 月 30 日
But if i use that i ge this error :
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer.
sia
sia 2013 年 5 月 30 日
And if use set(0,'RecursionLimit',7000) matlab crash :(

サインインしてコメントする。


sia
sia 2013 年 5 月 30 日
I know i call this function repeatedly, but how can i change the function to call it only one more time????

sia
sia 2013 年 5 月 30 日
I'm using this example but
but i dont have any idea to create a function. I mean i dont know what should be my inputs and outputs, and how these functions are nested to eacht other.
Can u guys help mepls??
THX

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by