Filter löschen
Filter löschen

How to draw multiple constant lines?

26 Ansichten (letzte 30 Tage)
Yasuyuki Hamanaka
Yasuyuki Hamanaka am 29 Mai 2021
Kommentiert: Cris LaPierre am 21 Feb. 2023
I want to draw multiple constant lines in a figure. I coded below using xline() and yline() refering Vertical line with constant x-value - MATLAB xline (mathworks.com). But it doesn't work. Would you tell me what is wrong?
xline([1,2,3]);

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 29 Mai 2021
Could you provide more details about what you mean by 'it didn't work'?
xline([1,2,3]);
xlim([0 5])
  2 Kommentare
Peter
Peter am 21 Feb. 2023
Bearbeitet: Peter am 21 Feb. 2023
Has the ability to include multiple lines changed from Matlab 2020b to 2021a?
I get "Passing multiple values to ConstantLine is not supported." when I try to include multiple x-coordinates to xline.
I'm able to do it in 2021b.
Cris LaPierre
Cris LaPierre am 21 Feb. 2023
Yes. The ability to include a vector of inputs to xline and yline was added in R2021a.
See the corresponding release notes.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Yasuyuki Hamanaka
Yasuyuki Hamanaka am 29 Mai 2021
Bearbeitet: Yasuyuki Hamanaka am 29 Mai 2021
When I code like this
clear;
xline([1,2,3]);
error happen.
Error using xline (line 29)
Passing multiple values to ConstantLine is not supported.
Error in test (line 2)
xline([1,2,3]);
I am using R2020b now. Should I install R2021a?
  3 Kommentare
Yasuyuki Hamanaka
Yasuyuki Hamanaka am 29 Mai 2021
I'm using R2020b version: 9.9.0.1592791 Update 5.
I'm going to install R2021a and try it. Thank you.
Katherine Zheng
Katherine Zheng am 24 Feb. 2022
I am using R2021a, but still have this issue. ?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by