i want to find out the mean of the matrix
but the matix should be given by users in command window
y= input(a);
% mean(mean(A,1),2);

 채택된 답변

Jan
Jan 2021년 8월 19일
편집: Jan 2021년 8월 19일

0 개 추천

A = input('Please input the matrix like "[1, 2; 3, 4]":');
% Type e.g.:
% [1, 2; 3, 4]
meanA = mean(A(:))
% Or in modern Matlab versions:
meanA = mean(A, 'all')
% Or more basic:
meanA = sum(A, 'all') / numel(A)
See:
doc input

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 GPU Computing에 대해 자세히 알아보기

질문:

2021년 8월 19일

편집:

Jan
2021년 8월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by