Subscript indices must either be real positive integers or logicals while using plot function

figure(1)
%time_north_sec=1x111 double
%Q_north_cut_off=111x111 double
plot(time_north_sec,Q_north_cut_off(:,1)*1e6)
xlabel('Lag (second)','FontWeight', 'bold')
ylabel('autocovariance function (mm^2)','FontWeight', 'bold')
title('North Autocovariance Function')
set(gca, 'fontsize', 16, 'fontweight', 'bold');
ylim = get(gca,'YLim');
ylim([31, 0]);
After running the code I get "Subscript indices must either be real positive integers or logicals while using plot function" although the plot seems OK.

 採用された回答

KSSV
KSSV 2016 年 12 月 16 日
編集済み: KSSV 2016 年 12 月 16 日
figure(1)
%time_north_sec=1x111 double
%Q_north_cut_off=111x111 double
plot(time_north_sec,Q_north_cut_off(:,1)*1e6)
xlabel('Lag (second)','FontWeight', 'bold')
ylabel('autocovariance function (mm^2)','FontWeight', 'bold')
title('North Autocovariance Function')
set(gca, 'fontsize', 16, 'fontweight', 'bold');
% ylim = get(gca,'YLim');
ylim([0 31]);
If you are not able to see your plot, try to play with ylim()....mention the ranges min first and then max.

4 件のコメント

sermet
sermet 2016 年 12 月 16 日
編集済み: sermet 2016 年 12 月 16 日
I get still the same error after commenting "ylim = get(gca,'YLim');"
KSSV
KSSV 2016 年 12 月 16 日
Attach the data which you are plotting...
sermet
sermet 2016 年 12 月 16 日
It is oked now, my mistake.
KSSV
KSSV 2016 年 12 月 16 日
Cool...

サインインしてコメントする。

その他の回答 (0 件)

タグ

質問済み:

2016 年 12 月 16 日

コメント済み:

2016 年 12 月 16 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by