how to make loop in

1 回表示 (過去 30 日間)
vaya putra
vaya putra 2019 年 7 月 14 日
回答済み: Stephan 2019 年 7 月 14 日
i want to extract matrix
total data 25 array
%km = 72x1 (matrix)
for x=1:25
cx = Km(x,1)+Km(x+1,1)+Km(x+6,1)+Km(x+7,1)+Km(x+36,1)+Km(x+37,1)+Km(x+42,1)+Km(x+43,1);
end
but there is only one result
my purpose is write c1,c2,c3,...,... until c25
anyone could help me

採用された回答

Stephan
Stephan 2019 年 7 月 14 日
%km = 72x1 (matrix)
x = zeros(25,1); % preallocate
for x=1:25
cx(x) = Km(x,1)+Km(x+1,1)+Km(x+6,1)+Km(x+7,1)+Km(x+36,1)+Km(x+37,1)+Km(x+42,1)+Km(x+43,1);
end

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by