Labelling Curves on a Graph, This code worked a decade ago, but will not work in 2023a
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Craig
am 6 Jan. 2024
Bearbeitet: Star Strider
am 7 Jan. 2024
This code worked fine a decade ago, but will not work in 2023a
X = [0 1100 1600 2400 2400 2800 3400 3800];
Y = fliplr(X);
figure
hold on
C(1, 1) = 100; % data value to plot on the line
C(2, 1) = length(X); % number of data points
C(1, 2 : length(X)+1) = X; % x data points for the line
C(2, 2 : length(X)+1) = Y; % y data points for the line
h_b = plot(X, Y, '-b', 'LineWidth', 2);
clabel(C, h_b, 'LabelSpacing', 1000)
It now results in
"Error using clabel
Not enough contour handles."
A decade ago I got the original idea from: https://stackoverflow.com/questions/19319455/matlab-graph-plotting-legend-and-curves-with-labels
and it worked fine. It made a graph similar to:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1584146/image.png)
Now the clabel command errors and I can't figure out how to fix it. Any help would be appreciated.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!