Problem while plotting twice in a figure
古いコメントを表示
I have 2 imported columns from excel (time and value), that contain more than 10000 rows, I plotted them and also the average of the whole values.
Now I want to plot both the time on the x axis and the values on the y axis with the average line (see second code) in one figure, I get the following error:
Values plotted against x-axis must be categorical values. To create categorical values, use the categorical function.
when I convert the value to a categorical one, it says: " Invalid data type. First argument must be numeric or logical."
Can Anyone tell me where the problem can be?
%the first correct code:
nexttile
plot(time,value)
nexttile
plot([0 size(value,1)],[avg avg], 'y-', 'LineWidth',2);
%The second one where I get the error:
nexttile
hold on
plot(time,value)
plot( [0 size(value,1)],[avg avg], 'y-', 'LineWidth',2);
hold off
2 件のコメント
KSSV
2020 年 8 月 11 日
Wjat is avg? How did you find it? Showus the full code.
Ramo Rafsel
2020 年 8 月 11 日
編集済み: Ramo Rafsel
2020 年 8 月 11 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
