Creating cell with NaN
42 次查看(过去 30 天)
显示 更早的评论
Hi,
I would like to re-create a NaN array like the attached image below. Meaning, the size of the array will be 1x187, but inside the array I rather each cell be a mx1. Example 2x1, 10x1, 3x1, 13x1, 4x1, etc.
Any help is appreciated.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/719389/image.png)
0 个评论
采纳的回答
the cyclist
2021-8-24
I was not 100% clear on what you wanted. Is this output right?
% Input array
C = {["Mercury","Gemini", "Apollo"; ...
"Skylab", "Skylab B","ISS"], ...
["Mercury","Gemini";
"Skylab","Skylab B"]}
% Output array
out = cellfun(@(x) nan(size(x,1),1) ,C,'UniformOutput',false)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!