"Index exceeds matrix dimensions." error

Hi, When I execute this code everything is okey except text line, it gives "Index exceeds matrix dimensions." error in this line. But x limits between 0 and 20, y limits between -4 and 16. I think that I missed out a point. Thanks for your help.
clc;
close all;
clear all;
[num,text,all] = xlsread('Data.xls','C3:C450'); % it takes dates as number
num=num+693960;%Excel Time to Matlab Time
dt=datestr(num);
temperature=xlsread('Data.xls','G3:G450');
ts1 = timeseries(temperature,dt);
plot(ts1)
xlim % 0 20
ylim % -4 16
text(10,10, 'Hello World')

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 13 日
編集済み: Azzi Abdelmalek 2013 年 7 月 13 日

1 投票

Check in your code: text was used as a variable
It's in the line
[num,text,all] = ...
replace it by
[num,text1,all] =

2 件のコメント

Jan
Jan 2019 年 6 月 26 日
@UMA: 'A1:E15' aren't valid indices in Matlab. Such definitions of ranges are working in Excel and therefore in xlsread. But in Matlab a char vector is converted to its ASCII-equivalent and as in your case you get indices out of the matrix dimensions:
double('A1:E15')
UMA RAMASAMY
UMA RAMASAMY 2019 年 6 月 26 日
[~,~, AllData] =xlsread('play.xls','Sheet1','A1:E15')... its working. so i removed my question. anyway thanks for ur answer.

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

その他の回答 (2 件)

net
net 2013 年 7 月 13 日

0 投票

Hi, Azzi Abdelmalek
Thanks for your help.
This is the important point which I missed.
Variable and the function name are the same.
Chris Clayton
Chris Clayton 2015 年 4 月 14 日

0 投票

Thanks from me as well. I had green text, blue text, and red text. Unfortunately, I named the green text as follows…
|gtext = '1700.17890';|
Now, when I wanted (later) to use the function 'gtext', I obtained the following
|>> gtext('trash')
Index exceeds matrix dimensions.|
So, I cleared gtext and all is fine!! So obvious (reserved string); lesson learned; useful to post it here.

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

net
2013 年 7 月 13 日

コメント済み:

2019 年 6 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by