How can i circle shift certain elements of two arrays simultaneously?

1 回表示 (過去 30 日間)
Joseph
Joseph 2018 年 5 月 17 日
回答済み: Fangjun Jiang 2018 年 5 月 17 日
i have an array
M=[ 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 5 5 6 6 6 6]
and another array
N=[
10 20 40 59 66 4 5 7 8 90 44 56 76 58 24 16 13 21 9 85 36
13 15 61 42 32 52 18 17 76 65 24 32 20 5 9 48 7 56 30 40 55]
note that each column of N(2,24) array is mapped to the identical element in M(1,24). now I want to circle shift all the elements 6 in N array as M=[ 6 6 6 6 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 5 5 ] and simultaneously circle shift the corresponding columns in N array. can anyone please help me.
thank you

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2018 年 5 月 17 日
circshift(M,4) and circshift(N,4) where 4 is the same.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by