フィルターのクリア

loop for a series of changing variable or tables

2 ビュー (過去 30 日間)
mirewuti muhetaer
mirewuti muhetaer 2020 年 3 月 25 日
コメント済み: darova 2020 年 3 月 26 日
Hi,
If i have a series of tables such as AX1, AX2,,,,,AX10.
And i want to extract element B from each AX sereis and save it in a new table.
I tried the following idea, but failed:
new_var=zeros(10,1);
for i=1:10;
new_var(i,1)=AZ'i'(5,1);
end;
But it did not work.
can someone help.
Thanks.

採用された回答

darova
darova 2020 年 3 月 25 日
My solution
A1 = table(1,2);
A2 = table(1,2);
A = {A1 A2};
for i = 1:2
AA = A{i};
new_var(i,1) = AA(5,1);
end
  2 件のコメント
mirewuti muhetaer
mirewuti muhetaer 2020 年 3 月 25 日
Hi, can you help me check this code:
Tjp={T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15};
n4=200;
for i=1:n2
for j=1:n4
TT1=Tjp{i};
if TT1(j,1) == "David"
jpmorgan(1,Q22016)=str2double(TT1(j,3));
end
end
end
But i always gives me this warning: Undefined operator '==' for input arguments of type 'table'.
Thanks.
darova
darova 2020 年 3 月 26 日
You can compare number using == operator
Use strcmp for string
if strcmp(TT1(j,1), "David")

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by