LoginSignup
0
1

More than 5 years have passed since last update.

Coursera Machine Learning WEEK2の宿題でエラー(set: unknown line property MarketSize)になった時の対処法

Posted at

はじめに

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

無事にエラーが解消しました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1