How do I make a simple table in MatLab? Skew function?

조회 수: 3 (최근 30일)
Macy
Macy 2023년 2월 9일
댓글: Macy 2023년 2월 9일
Hello. How can I make a table that displays the mean and median of "students" and "courses"?
Also, is there a way to calculate skew for "students" and "courses"?
table_a = readtable('Data1.xlsx')
table_a = 9×4 table
month year students courses _____ ____ ________ _______ 1 2000 12 4 2 2000 14 6 3 2000 13 5 4 2000 11 6 5 2000 17 8 6 2000 14 7 7 2000 10 5 8 2000 9 3 9 2000 16 4
mean (table_a.students);
median (table_a.students);
mean (table_a.courses);
median (table_a.courses);
%Calculate skew?
%Make/display a table of mean, median, and skew for students and courses
  댓글 수: 1
Arif Hoq
Arif Hoq 2023년 2월 9일
table_a = readtable('Data1.xlsx')
average=mean(table_a.students)
median_value=median(table_a.courses)
skew_students=skewness(table_a.students)
skew_courses=skewness(table_a.courses)

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

채택된 답변

Amal Raj
Amal Raj 2023년 2월 9일
편집: Amal Raj 2023년 2월 9일
table_a = readtable('Data1.xlsx');
% Calculate mean, median, and skew
mean_students = mean(table_a.students);
median_students = median(table_a.students);
skew_students = skewness(table_a.students);
mean_courses = mean(table_a.courses);
median_courses = median(table_a.courses);
skew_courses = skewness(table_a.courses);
% Create table
table_data = {'Students', mean_students, median_students, skew_students;
'Courses', mean_courses, median_courses, skew_courses};
table = cell2table(table_data, 'VariableNames', {'Variable', 'Mean', 'Median', 'Skew'});
% Display table
disp(table)
  댓글 수: 2
Macy
Macy 2023년 2월 9일
Thank you @Amal Raj! When I use the skew function, I get this error:
'skewness' requires Statistics and Machine Learning Toolbox.
Do you know what that issue means?
Macy
Macy 2023년 2월 9일
@Amal Raj nevermind I just have to install the toolbox! Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by