function [ med ] = CalculMedian( mat )

조회 수: 1 (최근 30일)
Slim Mannai
Slim Mannai 2018년 1월 23일
답변: Slim Mannai 2018년 1월 23일
Please can you help me,I have this probleme " Subscript indices must either be real positive integers or logicals" when I execute this function
function [ med ] = CalculMedian( mat ) vect=mat(:); % Transformer un matrice en un vecteur A=tri_bulle(vect);% tri a bulle de vect n=length(A); if mod(n,2)==0 med=A(n/2); %pair else med=A((n+1)/2); %impair end end

답변 (1개)

Slim Mannai
Slim Mannai 2018년 1월 23일
the erreur in this line
med=A(n/2); %pair
else
med=A((n+1)/2); %impair
% A is a table

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by