# MATLAB: How to choose a model depending on the highest value of coefficient of determination in Matlab

choose the corresponding model of the highest value of coefficient

I have a cell array which has many models and a double array which has the values of their coefficient of determination. I can specify the highest value of the coefficient. However, how can I choose the corresponding model for the highest value automatically?
Best regards& many thanks in advance

function [model] = returnModel(cModels, rSquare)  ind = find(max(rSquare)==rSquare); % This finds the index of the highest/max value                                     % of the coefficient of determination   model = cModels(ind); % returns the model corresponding to the maximum coefficient end