Effacer les filtres
Effacer les filtres

could any one please advise me on what is wrong with this code ?

1 vue (au cours des 30 derniers jours)
philip
philip le 21 Oct 2014
Commenté : philip le 21 Oct 2014
function classGrades = convertGrades NamesAndGrades (1:5,:)
L = 20; % size of M, NamesAndGrades
c = 11; % last column of the submatrix (of course c < L)
% create the submatrix (NamesAndGrades)
M = rand(L);
% extract the desired submatrix
grades = M(:,2:c);
end

Réponse acceptée

Orion
Orion le 21 Oct 2014
Hi,
so, many problems :
first line : what is the name of your function ? convertGrades, NamesAndGrades ? and in this line (1:5,:) has nothing to do here.
last line : grades = M(:,2:c); the output of your function is classGrades which is not defined in your code, i guess you need classGrades = M(:,2:c); ?
so depends on what you want to do, but here is function which works :
function classGrades = convertGrades
L = 20;
c = 11;
M = rand(L);
classGrades = M(:,2:c);
end
  1 commentaire
philip
philip le 21 Oct 2014
thanks very much for your support !, grate help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by