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

3 vues (au cours des 30 derniers jours)
>> 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).

Réponse acceptée

Shivank Anchal
Shivank Anchal le 9 Juin 2019
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.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by