How to normalize a matrix in such a wat that every row sum of X(:,:,i) should be 1 except for ith row
조회 수: 1 (최근 30일)
이전 댓글 표시
I have created a matrix X = rand([6,3,6]); i want to normalize this matrix in such a way that every row sum of X(:,:,i) should be 1 except for ith row.
Inside an while(1) loop ,i have
i=randi(n);
Say for example when i=2 that particular row sum should not be equal to one. same goes for other node.How it can be done?
댓글 수: 3
Jan
2021년 10월 24일
@IRANI ACHARJAMAYUM: What yre your inputs? How does X = rand([6,3,6]) and an infinite loop with i=randi(n) match? What is the wanted output?
It is still not clear, what you want to achieve. I've posted some code for normalizing the rows of a 3D array except for certain indices. Does it work? If not, what have to be changed?
답변 (2개)
Cris LaPierre
2021년 10월 23일
Why not just create a row vector of random numbers, and insert it into a matrix of ones?
댓글 수: 0
참고 항목
카테고리
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!