How to swap columns of matrix zeros(2,n)

1 回表示 (過去 30 日間)
amina shafanejad
amina shafanejad 2015 年 4 月 22 日
コメント済み: Star Strider 2015 年 4 月 22 日
Hello everyone
I'm working on one project which in need to swap all the columns of the matrix zeros(2,n) which i want to swap the first column with last column, second with second column from last, third column from third column from last and so on can anybody help me with it thank you.
  2 件のコメント
Jos (10584)
Jos (10584) 2015 年 4 月 22 日
Eh ... swapping two columns filled with zeros has no net effect, or does it?
Star Strider
Star Strider 2015 年 4 月 22 日
@Jos — As is the case with a lot of Questions here, I suspect this is a proxy for a different problem.

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

採用された回答

Star Strider
Star Strider 2015 年 4 月 22 日
From your description, the fliplr function would work.
  2 件のコメント
amina shafanejad
amina shafanejad 2015 年 4 月 22 日
thank you
Star Strider
Star Strider 2015 年 4 月 22 日
My pleasure!

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

その他の回答 (1 件)

Joseph Cheng
Joseph Cheng 2015 年 4 月 22 日
編集済み: Joseph Cheng 2015 年 4 月 22 日
well you can achieve this by
test = randi(10,2,10)
hfliptest = test(:,end:-1:1)
i cant remember if there is a built in function to do this. perhaps someone else knows but this should do it.
**edit oh there it is fliplr.
  1 件のコメント
amina shafanejad
amina shafanejad 2015 年 4 月 22 日
thank you for your response and help i think it will help me

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by