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 CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by