Counting lines on the y axis
1 次查看(过去 30 天)
显示 更早的评论
Hey, I want to count the lines on the y axis using the variables (A,B,C). Does anyone have a algorithm to do this with Matlab 2015?
Thanks
1 个评论
Jan
2018-2-7
The question is not clear. Which lines on what kind of y axis? And how do 3 variables, especially with the names A,B,C help to solve this?
回答(4 个)
Eliot Sperling
2018-2-15
1 个评论
Jan
2018-2-16
@Eliot: This is not clear: "each variable is a long list of numbers on Excel". If they are "on Excel", your question is off-topic in a Matlab forum. I assume, that it does not matter, if the "list" (maybe a "vector"?) is "long". But it does matter, what "they have let's say four y axis lines" means. Unfortunately this detail is not explained.
Eliot Sperling
2018-2-15
1 个评论
Jan
2018-2-16
@Eliot: Please do not post information, which helps to understand the question, in the section for answers. Insert the to the original question, where the readers expect to find all required details.
Star Strider
2018-2-15
I still have no idea what you’re asking.
See if one of these works for you:
x = 1:10;
y = rand(1, 10);
figure(1)
plot(x, y)
ytix = get(gca, 'YTick') % Values Of Y-Ticks
ytixnumber = numel(ytix) % Number Of Y-Ticks
figure(2)
plot(x, y)
ytix = get(gca, 'YTick'); % Values Of Y-Ticks
newytix = linspace(min(ytix), max(ytix), 4); % Define New Values For Y-Ticks, Set Number Of Y-Ticks To 4
newytixlabels = regexp(sprintf('%.2f\n',newytix), '\n','split'); % Format New Values For Y-Ticks
set(gca, 'YTick',newytix, 'YTickLabel',newytixlabels(1:end-1)) % Set New Values & Labels For Y-Ticks
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!