I need to plot vertical lines on a graph at points defined from an array imported from an excel file.
Samples = xlsread('ProjectData.xlsx','Sampling Strategy','A6:B44');
SampleDepth = Samples(:,2);
for i = 1:SampleDepth
xline(i);
end
SampleDepth is a 29x1 double. I need it to plot a vertical line (hence using xline) for each depth specified. I thought that using a for Loop like this would therefore plot a vertical line at each specified point, but Matlab returns:
Error using xline (line 29)
Must pass in a value.
Error in IsotopeGraphs (line 24)
xline()
What needs to be done to fix this? Can xline even be used like this or does it not work?
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/621268-plotting-multiple-vertical-lines-with-a-for-loop#comment_1076048
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/621268-plotting-multiple-vertical-lines-with-a-for-loop#comment_1076048
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/621268-plotting-multiple-vertical-lines-with-a-for-loop#comment_1076793
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/621268-plotting-multiple-vertical-lines-with-a-for-loop#comment_1076793
Sign in to comment.