Does line() function works in matlab R2015b ?
显示 更早的评论
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 ?
采纳的回答
更多回答(2 个)
Star Strider
2018-12-29
2 个投票
‘So. does MATLAB R2015B support line() function ?’
The line (link) function was ‘Introduced before R2006a’ according to the documentation, so it should.
‘both of thisX variables off course had the same length.’
True. However you horizontally concatenated two of them.
‘or was i just wrong while placing the arguments ?’
I would agree.
If we see your entire code, we would be able to provide more help.
Jan
2018-12-29
"h is subplot(4, 12, 1:12)" - this is not clear. Is h a scalar or a vector?
The message is clear: [thisX, thisX] and ylim(h) do not have matching sizes. So use the debugger to examine the problem:
dbstop if error
Type this in the command window and run the code again. When Matlab stops at the error, check the sizes:
size([thisX, thisX])
size(ylim(h))
3 个评论
Walter Roberson
2018-12-29
subplot(4, 12, 1:12)
subplot can be passed a vector of values for the third parameter. The effect is to create an axes that spans the referenced positions (which must form a rectangular sub-block)
Walter Roberson
2018-12-29
Watch out for thisX being row vector vs column vector. With column vector you might get away with it; with row vector you will not, not unless thisX is scalar.
Bachtiar Muhammad Lubis
2018-12-30
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
