MATLAB: Does line() function works in matlab R2015b

errorimagelineMATLABplotplotting

i had run code that used line() function. and then i got error in line() function.
Error using line
vectors must be the same length
Error in file_name (line 45)
line(h, [thisX, thisX], ylim(h), 'Color', 'r');
h is subplot(4, 12, 1:12).
both of thisX variables off course had the same length.
So. does MATLAB R2015B support line() function ? or was i just wrong while placing the arguments ?

Best Answer

ylim(h) is going to be a row vector of length 2. If your thisX is not scalar then the X values you construct would not be the same length .
you cannot use line() to draw a series of vertical lines. line() can only create one line object per call. plot() can create multiple line objects per call.