Effacer les filtres
Effacer les filtres

row of a random size matrix

4 vues (au cours des 30 derniers jours)
Jakob Nand
Jakob Nand le 22 Sep 2021
Commenté : Jakob Nand le 22 Sep 2021
hi,
i wanted to know how to seperate each row of a randomly sized (m,n) matrix

Réponses (2)

Shayan Sepahvand
Shayan Sepahvand le 22 Sep 2021
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
  1 commentaire
Jakob Nand
Jakob Nand le 22 Sep 2021
thanks

Connectez-vous pour commenter.


KSSV
KSSV le 22 Sep 2021
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

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by