フィルターのクリア

Remove empty cells and values for correlations

2 ビュー (過去 30 日間)
Thang  Le
Thang Le 2014 年 6 月 17 日
コメント済み: Star Strider 2014 年 6 月 23 日
Hi,
I have a 32x2 cell and I would like to do a correlation for the values in the first column with the values in the second column. However, there are blank cells in the first column. Could anyone help me find a way to do a correlation that excludes all the blank cells and their corresponding values in the second column?
Thanks!
  2 件のコメント
the cyclist
the cyclist 2014 年 6 月 17 日
"Blank cells" is not quite specific enough. Could you post a very small example (maybe 4x2 or so) that illustrates your input cell array? For example, do you mean
C = cell(4,2);
C{1,1} = 3;
C{1,2} = 4;
C{2,2} = 4;
C{3,1} = 6;
C{3,2} = 5;
C{4,1} = 4.1;
C{4,2} = 6.2;
where the 2nd row of the first column is an empty cell?
Or do you mean something else by "blank"?
Thang  Le
Thang Le 2014 年 6 月 17 日
編集済み: Thang Le 2014 年 6 月 17 日
I'm sorry for not being specific. An example would be:
[45] [20]
[16] [32]
[] [10]
[17] [6]
So (3,1) is an empty cell. So this is the same as your example, I think.

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

採用された回答

Star Strider
Star Strider 2014 年 6 月 17 日
Does this do what you want?
CData = {45 20; 16 32; [] 10; 17 6};
CE = cellfun(@isempty, CData(:,1));
Data = cell2mat(CData(~CE,:));
[R, P] = corrcoef(Data)
  6 件のコメント
Thang  Le
Thang Le 2014 年 6 月 23 日
Thank you again, Star Strider!
Star Strider
Star Strider 2014 年 6 月 23 日
My pleasure!

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

その他の回答 (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