I have a grid of cells and I want to get the average value of cells in the 7th column.

2 ビュー (過去 30 日間)
Okko
Okko 2016 年 2 月 20 日
編集済み: MHN 2016 年 2 月 20 日
I am new to Matlab. Here is what I am doing:
% mean(name_of_table(:,7))
but I get the error
% Undefined function 'sum' for input arguments of type 'cell'.
What's wrong?

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 2 月 20 日
mean(cell2mat(name_of_table(:,7))
Note: this will not work if "name_of_table" is referring to a table() data structure rather than to a cell array like in your question heading.

MHN
MHN 2016 年 2 月 20 日
mean(cell2mat(name_of_table(:,7)))
  1 件のコメント
MHN
MHN 2016 年 2 月 20 日
編集済み: MHN 2016 年 2 月 20 日
Based on the error, it seems you have a cell, not a table. Table is another type of variables in Matlab.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by