function [ med ] = CalculMedian( mat )

1 次查看(过去 30 天)
Slim Mannai
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