could any one please advise me on what is wrong with this code ?
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Orion
on 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
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!