Index in position 1 exceeds array bound (must not exceed 2) error

5 ビュー (過去 30 日間)
Shivank Anchal
Shivank Anchal 2019 年 6 月 9 日
回答済み: Shivank Anchal 2019 年 6 月 9 日
>> x=rand(5,5)
x =
0.8594 0.8865 0.7127 0.0424 0.8175
0.8055 0.0287 0.5005 0.0714 0.7224
0.5767 0.4899 0.4711 0.5216 0.1499
0.1829 0.1679 0.0596 0.0967 0.6596
0.2399 0.9787 0.6820 0.8181 0.5186
>> t=timer('timerfcn',@(x,y)disp(x(2,2)))
t =
Timer Object: timer-6
Timer Settings
ExecutionMode: singleShot
Period: 1
BusyMode: drop
Running: off
Callbacks
TimerFcn: @(x,y)disp(x(2,2))
ErrorFcn: ''
StartFcn: ''
StopFcn: ''
>> start(t)
Error while evaluating TimerFcn for timer 'timer-6'
Index in position 1 exceeds array bounds (must not exceed 1).

採用された回答

Shivank Anchal
Shivank Anchal 2019 年 6 月 9 日
t=timer('timerfcn',@(x,y)disp(x(2,2)) this line is incorrect ,it should have been t=timer('timerfcn',@(x1,y)disp(x(2,2)) instead.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by