Error in circularshift inside for loop.

Hi,
I need your help
I get this error message
In an assignment A(I) = B, the number of elements in B and I must be the same
when execute this code:
x=[2 3 4 5 6 7 8 9 1]
for i=1:6
b(i)=circshift(x,[0,i])
end
Thanks..

답변 (1개)

Walter Roberson
Walter Roberson 2018년 9월 22일

0 개 추천

circshift() like that is going to return a vector. You are trying to store the vector into the single location b(i) .
You can create rows (or columns) of a 2D array, or you can use cell arrays.

댓글 수: 2

methaq ali
methaq ali 2018년 9월 23일
thank you for replay, pleace can you give example.
x=[2 3 4 5 6 7 8 9 1]
for i=1:6
b(i, :)=circshift(x,[0,i])
end

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2018년 9월 22일

댓글:

2018년 9월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by