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