Index in position 2 exceeds array bounds.

I am getting this error for following code to export the the data from graph.

7 件のコメント

KSSV
KSSV 2022 年 12 月 4 日
Check the size of the variable num.
whos num
It seems, num is only a array with once column.
Venkata
Venkata 2022 年 12 月 4 日
> whos num
Name Size Bytes Class Attributes
num 0x0 0 double
Venkata
Venkata 2022 年 12 月 4 日
should i need to change any thing
Venkata
Venkata 2022 年 12 月 4 日
num = readmatrix('viveek.xlsx');
x = num(:,1);
y = num(:,2);
x1 = -17:0.09:0.9;
y1 = interp1(x,y,x1,'spline');
figure(1);
plot(x,y,'+b',x1,y1,':.');
title('linear interpolation');
fig = gcf;
axObjs = fig.Children;
dataObjs = axObjs.Children;
x = dataObjs(1).XData;
y = dataObjs(1).YData;
Dyuman Joshi
Dyuman Joshi 2022 年 12 月 4 日
The variable num is empty, as it shows in its size. You can't access any elements from it.
Check if the excel file is empty or not. What are the contents of the excel file?
Venkata
Venkata 2022 年 12 月 4 日
The excel file was empty
Should i fill any thing overthere
Jan
Jan 2022 年 12 月 4 日
Well, yes, of course you should use an Excel file with values.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Import from MATLAB についてさらに検索

タグ

質問済み:

2022 年 12 月 4 日

コメント済み:

Jan
2022 年 12 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by