Replace numbers in a matrix
조회 수: 4 (최근 30일)
이전 댓글 표시
Here is my code below. I have created a randon 2*x4 matrix. I have replace the first row with 1:4. and the third colume with 10:11. so my question is how do i replace the 4th colume with 2 and 5? or something like 9 and 8, without using the colon operator..
mat = randi([1,10],2,4)
mat(1,:) = 1:4
mat(:,3) = 10:11
댓글 수: 0
채택된 답변
Cris LaPierre
2021년 6월 16일
Create your vector of numbers using square brackets, and assign it to column 4 the same way you did for the 3rd column.
Hint: 10:11 is the same as [10 11]
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!