row of a random size matrix

조회 수: 3 (최근 30일)
Jakob Nand
Jakob Nand 2021년 9월 22일
댓글: Jakob Nand 2021년 9월 22일
hi,
i wanted to know how to seperate each row of a randomly sized (m,n) matrix

답변 (2개)

Shayan Sepahvand
Shayan Sepahvand 2021년 9월 22일
Use this code:
[m, n] = size(X);% X is that random matrix
row_mat = zeros(m, 1);
for i = 1:m
row_mat = X(i,:);
end
row_mat is the seperated row

KSSV
KSSV 2021년 9월 22일
A = rand(5,4) ;
a = num2cell(A',1) ;
A(1,:)
ans = 1×4
0.3849 0.5708 0.5962 0.5155
a{1}
ans = 4×1
0.3849 0.5708 0.5962 0.5155

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by