フィルターのクリア

How to make each vector of equal size in a cell by adding NAN

2 ビュー (過去 30 日間)
Sag
Sag 2016 年 2 月 8 日
コメント済み: Sag 2016 年 2 月 9 日
A cell with row vectors in it(Vectors are of 2 sizes: either 1x2544 or 1x2545). To process the data, It needs to have vectors of equal size . Is there any code which could add NaN to the the short vectors (1x2544) and make them 1x2545?
Thanks

採用された回答

Guillaume
Guillaume 2016 年 2 月 8 日
c = {rand(1, 2544); rand(1, 2545); rand(1, 2544)} %demo data
maxlength = max(cellfun(@numel, c));
newc = cellfun(@(v) [v, nan(1, maxlength-numel(v))], c, 'UniformOutput', false)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by