フィルターのクリア

A for cycle to repeat the same action for all columns

2 ビュー (過去 30 日間)
Mario Diaco
Mario Diaco 2020 年 5 月 23 日
コメント済み: Mohammad Sami 2020 年 5 月 27 日
Hi!
I would repeat this process for all variables (where variables are countries names) in a table (where table is "SpreadCurves")
%example code
for i=1:height(CDS_1Y)
DefaultProbCurve{i} = defprobstrip(ZeroCurves(i,:), MarketCDSInstruments(:,i), SpreadCurves{i,26}.Italy);
end
I tried to change the column value "26" with a generical indicator "j" in an other for cicle, but I've to change manually the name variable name after the fullstop. Can I automatize this process?
Thanks.
  4 件のコメント
dpb
dpb 2020 年 5 月 26 日
For varfun or row fun, yes.
But you said you had a table "SpreadCurves"
We would need to be able to see the data storage you have for what you're trying to do to be able to write actual code.
Having to change variable names for an iterative process is a sign the storage isn't ideal for the purpose.
Mohammad Sami
Mohammad Sami 2020 年 5 月 27 日
Tables columns can also be accessed with numerical index.
col1 = tabl.(1)
i = 4;
coli = tab1.(i);

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by