はじめに
CourseraのMachine Learning WEEK2で、初めて宿題を出そうと思っていたら、はるか前段でエラーになったので、対処方法のメモです。
エラーになったコード
「2.1 Plotting the Data」に記載のあるコードで、コピペすれば動くはずの内容になっています。
plotData.m
plot(x, y, 'rx', 'MarkerSize', 10); % Plot the data
ylabel('Profit in $10,000s'); % Set the y−axis label
xlabel('Population of City in 10,000s'); % Set the x−axis label
エラーメッセージ
error: set: unknown line property MarketSize
error: called from
__line__ at line 120 column 16
line at line 56 column 8
__plt__>__plt2vv__ at line 502 column 10
__plt__>__plt2__ at line 248 column 14
__plt__ at line 113 column 17
plot at line 223 column 10
plotData at line 19 column 1
ex1 at line 47 column 1
property MarketSize
がunknownと言われているので、そこを修正してあげれば良さそうです。
修正方法
Octaveのドキュメントをのぞいてみます。
Multiple property-value pairs may be specified, but they must appear in pairs. These arguments are applied to the line objects drawn by plot. Useful properties to modify are "linestyle", "linewidth", "color", "marker", "markersize", "markeredgecolor", "markerfacecolor". See Line Properties.
正しいプロパティ値は全て小文字でmarkersize
のようです。
修正したコード
plotData.m
plot(x, y, 'rx', 'markersize', 10); % Plot the data
ylabel('Profit in $10,000s'); % Set the y−axis label
xlabel('Population of City in 10,000s'); % Set the x−axis label
無事にエラーが解消しました。