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
  1 件のコメント
philip
philip 2014 年 10 月 21 日
thanks very much for your support !, grate help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by