Use of assignment '=' in plot command?

Hi
There is a lot of ways to ask this question and it is maybe more of a discussion topic, but with ~10 years of medium MATLAB use I got a bit confused by this way of calling plot so I ask:
Should this code run/work?
y=1:10;
plot(y,'.-',linewidth=2)
Or maybe I just missed some release notes explaining this?

 採用された回答

Stephen23
Stephen23 2022 年 1 月 18 日
編集済み: Stephen23 2022 年 1 月 18 日

0 投票

That name-value sytnax was introduced in R2021a:
y=1:10;
plot(y,'.-',linewidth=2)
% ^^^^^^^^^^^ this syntax introduced R2021a
"Or maybe I just missed some release notes explaining this?"
The new syntax is explained in the MATLAB documentation, MATLAB blogs, and Release Notes:
Before R2021a you will have to use the old approach (which of course still works in the newer versions):
plot(y,'.-','linewidth',2)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

製品

リリース

R2021b

質問済み:

2022 年 1 月 18 日

編集済み:

2022 年 1 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by