Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Changing the tick labels in MATLAB for each loop iteration

  1. Jan 28, 2012 #1
    Suppose that I am plotting some data that corresponds to "i" different functions. So on the plot I have "i" number of curves on one plot. Instead of using a legend, I would like to label the y-axis x mark that corresponds to the function. I can do this using the set gca tick label function. Here's the catch, the plotting of the "i" number of curves repeats for "k" times. Each "kth" iteration, the number of curves on the plot may or may not be the same as the previous "k" iteration. I can create an array based on "i" which would label the y tick marks but I want to include the letter "N" followed by the "ith" curve". See attached figures. Right now I have to do the labeling manually for each iteration.
     

    Attached Files:

    • k=1.jpg
      k=1.jpg
      File size:
      21.5 KB
      Views:
      104
    • k=2.jpg
      k=2.jpg
      File size:
      22.5 KB
      Views:
      112
    • k=3.jpg
      k=3.jpg
      File size:
      24.7 KB
      Views:
      99
  2. jcsd
  3. Jan 29, 2012 #2

    jhae2.718

    User Avatar
    Gold Member

    http://www.mathworks.com/help/techdoc/creating_plots/f6-7929.html#f6-27773 [Broken]
     
    Last edited by a moderator: May 5, 2017
  4. Jan 29, 2012 #3
    I've tried using that and it doesn't work for what I need. I need the letter "N" then followed by the basis function number "i" then "," followed by the iteration number "k". So for the first iteration starting at the top most line I'll have something like N0,1, N1,1, N2,1...For the second iteration I'll have something like N0,2, N1,2, N2,2...However I can't just set the tick label because for each iteration, I might have a different number of basis functions to label.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Changing the tick labels in MATLAB for each loop iteration
  1. Iteration loops (Replies: 3)

Loading...