Get data from each row as inputs to a function
古いコメントを表示
Hi everyone, I have a function f(a,b,c,x,y) where a,b,c are fixed and I have to get x,y from a table of data. I'm thinking of creating columns with all a's, b's and c's and then apply the function. Is this a good idea? Is there anyway I can loop through each row and compute the function for that row instead?
3 件のコメント
Wan Ji
2021 年 12 月 22 日
Please show more details about your function and input variables
KSSV
2021 年 12 月 22 日
Show us the function f. Mostly you may need not to run a loop.
Clover Nguyen
2021 年 12 月 22 日
回答 (1 件)
Stephen23
2021 年 12 月 22 日
N = numel(Strike);
Volatility = cell(1,N);
for k = 1:N
Volatility{k} = impvbybjs(RateSpec,StockSpec,Settle,Maturity,OptSpec,Strike(k),OptPrice(k));
end
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!