フィルターのクリア

Creating cell with NaN

55 ビュー (過去 30 日間)
Daneisha Blair
Daneisha Blair 2021 年 8 月 23 日
コメント済み: Daneisha Blair 2021 年 8 月 24 日
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.

採用された回答

the cyclist
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"]}
C = 1×2 cell array
{2×3 string} {2×2 string}
% Output array
out = cellfun(@(x) nan(size(x,1),1) ,C,'UniformOutput',false)
out = 1×2 cell array
{2×1 double} {2×1 double}
  1 件のコメント
Daneisha Blair
Daneisha Blair 2021 年 8 月 24 日
Yes, this did exactly what I wanted. Thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by