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

1 次查看(过去 30 天)
>> 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 CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by