Continuous execution of vertical line for set of data
3 views (last 30 days)
Show older comments
Answered: Steven Lord on 12 Mar 2021
I'm new to Matlab
I want to plot a vertical line at specific values which I have stored in a variable, "HR"
For some data sets, there are several values within the variable and it would take a lot of time to plot a vertical line at each value.
Can someone help me write a code that continues to execute plotting this vertical line through the entire data set?
In the variable "HR" I have stored all of the values below. I want to plot a vertical line at each of these values. How would I go about writing a code or iterative loop to do this until it has plotted lines at each of these points and finished the data set?
ANKUR KUMAR on 12 Mar 2021
"I want to plot a vertical line at each of these values. ". The array you provided is 1D array. You will get 1 line plot out of these array.
Are you trying to plot multiple line in the plot out of this data?
What is the dimension size of the array?
More Answers (1)
Steven Lord on 12 Mar 2021
It's not clear to me exactly what type of graphic you're trying to plot, but I think the stem and xline functions may be of use to you. Alternately, open the Plots tab on the Toolstrip. Click the small downward-pointing triangle in the Plots section of that tab and look for a thumbnail that appears similar to the type of plot you want to create. From there you can determine the specific plotting function used to create that type of plot (its name is below the thumbnail) and read its doc page to learn how to use it. You can even create the plot from the thumbnail if you have your data selected in the Workspace window.
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!