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

조회 수: 1 (최근 30일)
philip
philip 2014년 10월 21일
댓글: philip 2014년 10월 21일
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

채택된 답변

Orion
Orion 2014년 10월 21일
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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by