フィルターのクリア

Use of Circshift command : possible bug.

3 ビュー (過去 30 日間)
Pragya Srivastava
Pragya Srivastava 2017 年 2 月 14 日
コメント済み: Pragya Srivastava 2017 年 2 月 14 日
Hi, I am using circshift to periodically shift a 2d array. According to MATLAB documentation https://uk.mathworks.com/help/matlab/ref/circshift.html
circshift(A,[degree,dim])
shifts A by degree along dim. This works when dim=1 : I get expected result of circshift(A,[degree,1]) But for dim=2 I need to switch i.e. I have to use circshift(A,[2,degree]) to get desired result. I am using MATLAB 2016a. Please have a look.

採用された回答

John D'Errico
John D'Errico 2017 年 2 月 14 日
編集済み: John D'Errico 2017 年 2 月 14 日
Funny, that is NOT how the documentation describes it. Here is the pertinent section:
B = circshift(A,[1 -1]) % circularly shifts first dimension values
% down by 1 and second dimension left by 1.
If the second argument is a TWO element vector, then the one of the elemnts is NOT the dimension. The first element tells how far to shift in dimension 1. The second element tells how far to shift in dimension 2.
If you wish to specify a circular shift dimension dim by extent k, then use THREE arguments.
circshift(A,k,dim)
So there is a bug, but it is in your reading of the help for circshift. The help itself accurately describes what the code does.
  1 件のコメント
Pragya Srivastava
Pragya Srivastava 2017 年 2 月 14 日
Okay. Thanks for clarification. I was misreading [1 2] to be 1,2.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by