How to make from different size matrices one size matrices by adding NaN's?

2 ビュー (過去 30 日間)
IM
IM 2019 年 9 月 17 日
コメント済み: IM 2019 年 9 月 17 日
Hi!
I have a cell array with matrices of different size :
X ={ {6x12x4},{5x12x4}, {10x12x4},{ 6x12x4}, {8x12x4 }}
How can I make all of them in the same size by adding NaNs?
I need as result : X = {10x12x4, 10x12x4, 10x12x4, 10x12x4, 10x12x4 }
Thanks in advance!

採用された回答

Jon
Jon 2019 年 9 月 17 日
編集済み: Jon 2019 年 9 月 17 日
You could do something like this:
X = {rand(6,12,4),rand(5,12,4),rand(6,12,4),rand(8,12,4)}; % generate example data
for k = 1:length(X)
m = size(X{k},1);
X{k}(m+1:10,:,:) = NaN
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by