How do i create a matrix of size 1 row and 1501 column, with values [1 -1 1 -1 1 -1.... etc
조회 수: 3 (최근 30일)
이전 댓글 표시
답변 (3개)
Wayne King
2012년 5월 1일
One way:
x = ones(1,1501);
x(2:2:end) = -1*x(2:2:end);
Another way
y = repmat([1 -1],1,751);
y(end) = [];
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!