フィルターのクリア

Reshape vector in a loop

1 回表示 (過去 30 日間)
Simon
Simon 2014 年 7 月 1 日
回答済み: Roger Wohlwend 2014 年 7 月 1 日
Dear all,
I want to form a vector x=[0 1 2 3 4 ... n] in a loop to xx=[0 1] xx=[1 2] xx=[2 3] ... xx=[n-1 n]
What I have know is this:
for k=1:numel(x)/2
xx=x(2*k-1:2*k)
...
...
end
But that gives me only xx=[0 1] xx=[2 3] xx=[4 5]. It shouldnt be all that difficult, but my mind just dont seem to get the answer.
Thanks!

採用された回答

Roger Wohlwend
Roger Wohlwend 2014 年 7 月 1 日
for k = 1 : n
xx = [k-1, k];
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