フィルターのクリア

Index exceeds matrix dimensions

1 回表示 (過去 30 日間)
Fadilla Atyka Nor Rashid
Fadilla Atyka Nor Rashid 2018 年 8 月 13 日
%SET UP USEFUL VARIABLES
NumControls = 2; %number of control experimetns with no grating
dt = 1; %spacing between samples time point [ms]
t_On = 0; %time stimulus turns on [ms]
t_Move = 500; %time stimulus begins moving [ms]
t_Off = 2500; %time stimulus turns off [ms]
NumAngles = size(d, 1) - NumControls; %number of angles tested, equally spaced
NumTimePoints = size(d, 2); %number of time points; time was sampled evert 1 ms
NumTrials = size(d, 2); %number of trials performed at each angle
t_vect=t_On:dt:(NumTimePoints-1)*dt; %time vector for each trial
ThisOrientation = 10; %element index of orientation we are currently analyzing
%PLOT RASTERS FOR ONE PARTICULAR ANGLE
figure(1)
for trial=1:NumTrials
plot(t_vect,trial*d(ThisOrientation,:,trial),'+')
hold on
end
The error hows index exceeds matrix dimensions on the line plot(t_vect,trial*d(ThisOrientation,:,trial),'+')
Tried to figure out myself by browsing all the same error but can't find any. Can anyone please help me since I might be overlooked?
my data size is 4x15x30 double. Thanks a lot!
  1 件のコメント
KSSV
KSSV 2018 年 8 月 13 日
d(ThisOrientation,:,trial)
The above extracts, ThisOrientatoion row from the 3d matrix trial. YOur ThisOrientation is 15. But your d has only four rows. So the error.

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

採用された回答

KSSV
KSSV 2018 年 8 月 13 日
Your ThisOrientation should be less then or equal to the number of rows in d.
ThisOrientation = 4 ; % it should be less then or equal to 4
  1 件のコメント
Fadilla Atyka Nor Rashid
Fadilla Atyka Nor Rashid 2018 年 8 月 13 日
It works! Thanks a lot :)

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by