Index in position 1 exceeds array bounds (must not exceed 5).

1 回表示 (過去 30 日間)
Mohamed Azith
Mohamed Azith 2019 年 9 月 25 日
コメント済み: Ankit 2019 年 9 月 25 日
I wanna insert a value in a particular cell in a table. Mine is a 5x10 matrix,but still I get this error.
f = figure;
tab={0.0,'','','','','','','','','';
'','','','','','','','','','';
3.5,'','','','','','','','','';
'','','','','','','','','','';
7.0,'','','','','','','','','';
};
t = uitable(f,'Data',tab(100,5,10),'ColumnName',{'Stratum no.','Elevation','Depth','Thickness','Graphic log','Description of soil','BLow-1','Blow-2','Blow-3','N'});
t.Data(1,5) = 4242;
  1 件のコメント
Ankit
Ankit 2019 年 9 月 25 日
use randi(100,5,10) instead of tab(100,5,10) if you want to fill data.

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

回答 (1 件)

Jan
Jan 2019 年 9 月 25 日
The variable tab has the dimensions 5 x 10. You try to access the indices [100, 5, 10]. This cannot work. I guess, you want to replace
t = uitable(f,'Data',tab(100,5,10), ...
by
t = uitable(f, 'Data', tab, ...

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by