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

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by