Storing the inputs of a function on a structure (or cell or array)
2 ビュー (過去 30 日間)
古いコメントを表示
given a function such as:
function [z,w] = tempFun(x,y)
z = x+1;
w = y+1;
end
is it possible to store a given pair x,y as a structure (struct('x',1,'y',2), say, or as a cell or anything else...) and then unpack it and apply the function to the output?
(In python this could be done as: temFun( **{'x':1, 'y':2})
0 件のコメント
採用された回答
madhan ravi
2019 年 8 月 15 日
d=struct('x',1,'y',2);
[z,w] = tempFun(d)
function [z,w] = tempFun(s)
z = s.x+1;
w = s.y+1;
end
6 件のコメント
madhan ravi
2019 年 8 月 15 日
編集済み: madhan ravi
2019 年 8 月 15 日
Well, I'm a beginner in python (didn't get to this point still) , but this topic would be interesting to be debate about. But then do not underestimate the power of MATLAB ;-)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!