Using a variable where a string is required
Show older comments
Hi there. I'm starting to use MATLAB again after some time away from it and have a simple question I hope someone can help with. I have a large data set with many columns that I would like to plot, and then use the plot browser to examine particular elements of the data set. Is there a way to have my looped integer variable k appear as the correct number in the "DisplayName" field? My script is below.
Also, can anyone recommend a way for looping through colors? As the script is below all of the plots appear blue. I know that MATLAB will automatically cycle through colors if multiple Y's are given in the plot command, but is there a way to do both at the same time, loop through the colors and also write a unique "DisplayName"?
Thanks in advance for any help you can offer!
k=6;
hold on
plot(time,e129a_trpshift,'DisplayName','TRP Shift')
while (k<12)
plot(time,e129a_ResidueVsTime(:,k),'DisplayName','k')
k=k+1;
end
Best Wishes, Nathan
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!