Concatenating cell arrays with a different number of columns
4 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Guillaume
2019 年 6 月 13 日
編集済み: Guillaume
2019 年 6 月 13 日
maxcols = max(cellfun('size', NonC_tRNAs, 2)); %get the number of columns of the widest array
padded = cellfun(@(m) [m, zeros(size(m, 1), maxcols - size(m, 2))], NonC_tRNAs, 'UniformOutput', false); %pad each array
NonC_tRNAs_Reference = vertcat(padded{:})
7 件のコメント
mmfjerstad
2020 年 3 月 16 日
Sorry if this is a dumb question, but what is "m" in this instance?
padded = cellfun(@(m) [m, zeros(size(m, 1), maxcols - size(m, 2))], NonC_tRNAs, 'UniformOutput', false); %pad each array
Guillaume
2020 年 3 月 16 日
" what is "m" in this instance?"
An arbitrary name for the input variable of the anonymous function called by cellfun. It will be in turn each element of the same array.
その他の回答 (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!