フィルターのクリア

repeat loop in a table

3 ビュー (過去 30 日間)
Matt Brianik
Matt Brianik 2018 年 1 月 16 日
How do i make it so that the code below will replace T(i)==5 with Y(i) in multiple columns of table T. I can get it to work well when there is only one columns but have trouble making it repeat in additional columns
clear
X=(1:12);
Y=(101:112);
Table = [X;Y;Y;Y;X]
T=X.'
T=[T;T]
i=1
for n=1:12
if T(i)==5
T(i)=Y(i)
else
T(i)=T(i)
i=i+1
end
end

回答 (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