Borrar filtros
Borrar filtros

How to use xline?

94 visualizaciones (últimos 30 días)
Tomaszzz el 18 de Jul. de 2022
Comentada: Tomasz Cudejko el 18 de Jul. de 2022
Hi all,
I have a signal (attached) over which I would like to plot mutiple vertical lines using x values (see image below)
x = [1648;2871;4022;6216;7327;8416]
My approach below:
can you help please?
load 'signal'
plot(cop_x_l); hold on
xline([x], repmat(ylim',1,size(x,2)), '--r')
Error using xline (line 29)
Passing multiple values to ConstantLine is not supported.

Respuesta aceptada

Steven Lord
Steven Lord el 18 de Jul. de 2022
The ability to create multiple vertical or horizontal lines by passing a vector of values into the xline or yline functions was introduced in release R2021a. For earlier releases you'll need to call xline or yline once per value (perhaps in a for loop.)
  1 comentario
Tomasz Cudejko
Tomasz Cudejko el 18 de Jul. de 2022
@Steven Lord Thanks Steven, that explain my issues

Iniciar sesión para comentar.

Más respuestas (2)

vishweshwar samba
vishweshwar samba el 18 de Jul. de 2022
Try this
x = [1,2,3,4,5]; % x interval
% load signal instead of data below
z = linspace(0,6,100);
y = exp(z);

Abderrahim. B
Abderrahim. B el 18 de Jul. de 2022
Editada: Abderrahim. B el 18 de Jul. de 2022
Try this
sig = rand(1,10000) ;
x = [1648 2871 4022 6216 7327 8416] ;
hold on
xline(x, '--r')
Hope this helps


Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.


Community Treasure Hunt

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

Start Hunting!

Translated by