Reversing the order of EVEN rows in an array

3 ビュー (過去 30 日間)
Jason
Jason 2021 年 1 月 17 日
コメント済み: Jason 2021 年 1 月 17 日
I have a matrix D that consists of 12 cols and 8 rows.
How can I reverse the order of even rows.
i.e. for a simplifeid 4,3 case
>> d=rand(4,3)
d =
0.1067 0.8173 0.2599
0.9619 0.8687 0.8001
0.0046 0.0844 0.4314
0.7749 0.3998 0.9106
I want it to appear as:
d =
0.1067 0.8173 0.2599
0.8001 0.8687 0.9619
0.0046 0.0844 0.4314
0.9106 0.3998 0.7749

採用された回答

Ive J
Ive J 2021 年 1 月 17 日
d(2:2:end, :) = fliplr(d(2:2:end, :));
  1 件のコメント
Jason
Jason 2021 年 1 月 17 日
Perfect, thankyou

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by