help needed with variables within functions!!

1 回表示 (過去 30 日間)
Mustafa
Mustafa 2011 年 11 月 29 日
hello there if there is a function that depends on 3 variables t,x and y [f(t,x,y)] but inside this function is another function that is independent on y [g(t,x,?)], how do I tell matlab to ignore the y term?
  1 件のコメント
Image Analyst
Image Analyst 2011 年 11 月 29 日
Delete the offending lines?

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

採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 29 日
Just do not pass y to g?
Or edit g to add varargin as the last function argument, something like
function result = g(t,x,varargin)
and then just have g ignore varargin ?
Or if you have a newer (2009a or later?) MATLAB, edit g to add ~ as the last function argument, something like
function result = g(t,x,~)
Or if you have an older MATLAB, edit g to add y as the last argument but do not use y in g, something like
function result = g(t,x,y)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by