converting a cell array to a matrix
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
AA
le 26 Nov 2014
Réponse apportée : Azzi Abdelmalek
le 26 Nov 2014
consider the following example
a={rand(1877958,7); rand(1251972,7)};
i want this to be converted to a matrix. i know that the rows are not the same but the remaining rows can be filled with zeros. how can i do that?
thanks
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 26 Nov 2014
a={rand(1877958,7); rand(1251972,7)};
n=max(cellfun(@(x) size(x,1),a));
b=cell2mat(cellfun(@(x) [x ;zeros(n-size(x,1),7)],a,'un',0))
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!