creating a 8x8 matrix with only -1
조회 수: 10 (최근 30일)
이전 댓글 표시
i want to create a 8x8 matrix withn only the number -1 how do i do it?
댓글 수: 0
답변 (3개)
Torsten
2024년 10월 27일
이동: Torsten
2024년 10월 27일
Use "ones" to build a matrix of ones and multiply it by (-1).
댓글 수: 1
Walter Roberson
2024년 10월 28일
You have to be careful to build up the 8 x 8 size for the ones() call, out of pure -1's. It is certainly possible to do.
埃博拉酱
2024년 10월 28일
편집: 埃博拉酱
2024년 10월 29일
-ones(8)
Append at 20241029 as a Cody challenge:
rand(single('('-' '))
%You don't even need -1 in your code. This can be applied to any challenge that has a limit on the number that appears in the code.
%If you're okay with using characters that aren't on your keyboard, you can even just use a Backspace character (U+0008).
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!