When i use xlsread command, i get this error "index out of bounds because size(data)=[33,5]."

1 回表示 (過去 30 日間)
ram
ram 2015 年 2 月 1 日
回答済み: Rajanya 2025 年 3 月 18 日
The xlsread command used to work fine for me until this happened. Below is the code i'm using: clc clear data = xlsread('Crss_measured.xlsx'); x1 = data(:,1) x2 = data(:,2) x5 = data(:,7) x6 = data(:,8) semilogy(x1,x2,x5,x6) axis([0 600 0.0001 10000])
And the error i keep getting which i don't believe is the error:
Attempted to access data(:,7); index out of bounds because size(data)=[33,5].
Error in Crss_excelread (line 9)
Plz help! x5 = data(:,7)

回答 (1 件)

Rajanya
Rajanya 2025 年 3 月 18 日
Hi @ram,
This just meant that the file 'Crss_measured.xlsx' had only 5 columns (size - [33,5]) and 'data(:,7)' was trying to access the seventh column which did not exist, leading to the error.
Thanks.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by