フィルターのクリア

How to write a sequential algorithm

2 ビュー (過去 30 日間)
juan sanchez
juan sanchez 2022 年 4 月 3 日
回答済み: Voss 2022 年 4 月 3 日
Example:
I have this algorithm A:
i=1 Columns=[1:36];
A=[(Columns(i)-1)*3+1:Columns(i)*3];
%Vector
When i=1 A=[1, 2, 3]
When i=2 A=[4, 5, 6]
When i=3 A=[7, 8, 9]
How to do another Algorithm A=?
When i=1 A=[1, 4, 7]
When i=2 A=[3, 5, 8]
and so on...

回答 (1 件)

Voss
Voss 2022 年 4 月 3 日
I think the first element of A when i = 2 should be 2 instead of 3. If so, then:
Columns=[1:36];
for i = 1:numel(Columns)
A = i+[0 3 6];
end

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by