Access outer varargin inside a nested function

10 ビュー (過去 30 日間)
Debabrata Ghosh
Debabrata Ghosh 2020 年 9 月 5 日
編集済み: Bruno Luong 2020 年 9 月 5 日
Hey guys, I was wondering if somebody could help me with an issue related to 'varargin'. My main/outer function has a 'varargin'. And then, I have a nested function (a function for a SLIDER) that has a 'varargin' as well. Is it possible that I could access the varargin of the outer function, and use it inside the nested function? Thanks!

採用された回答

Bruno Luong
Bruno Luong 2020 年 9 月 5 日
編集済み: Bruno Luong 2020 年 9 月 5 日
A varargin is just a cell. So pass it in the nested function as input argument
function outer(a, b, varargin)
function inner(c, d, outervarargin, varargin)
e = outervarargin{1};
piiii = varargin{1}
end
outervarargin = varargin;
inner('c', 'd', outervarargin, pi);
end
outer('a', 'b', 'e');

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by