Even vs Odd Vector
8 ビュー (過去 30 日間)
古いコメントを表示
write a function that outputs a vector of only the odd indices of the input vector if that input's length is odd. if the input's length is even, then output a vector of its even indices. So if you input os [1 2 3 4 5 6], then your output should be [2 4 6]; if your input i s[1 2 3 4 5 6] then you should output [1 3 5].
3 件のコメント
Joseph Cheng
2014 年 9 月 4 日
編集済み: Joseph Cheng
2014 年 9 月 4 日
Done, now what? All joking aside what have you tried? A hint to start would look at the function mod(). Also i think your last odd length example is wrong.
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!