How to find the average of a column in a cell array

For our coding assignment we needed to create a cell array with information about elements in a periodic table. I was able to make the cell array using the code attached below. Now I need to find the average of all the 'Atomic Weights' which is one of the inputs that I used in the code. How do I write the code to find the average for all of the Atomic Weights inputted into the cell array?

 채택된 답변

Image Analyst
Image Analyst 2015년 10월 29일
Why turn it into a cell??????????????????????
Just get the average from the structure array. No need for the overhead and complication of a cell array!
meanAtomicWeight = mean([periodic_table.AtomicWeight]);

댓글 수: 1

okay so I got that part now it's asking me to find the average value for certain values i.e. not the whole column but only like 3 values in the column. How would I go about this?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2015년 10월 29일

댓글:

2015년 10월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by