Index exceeds matrix dimensions
1 次查看(过去 30 天)
显示 更早的评论
data_video = zeros(conf{layer,1}.filt_h*conf{layer,1}.filt_w*conf{layer,1}.in_frames ...
*conf{layer,1}.in_fmaps, num_patch); %zeros(15*15*3*1,1000)
for idx = 1:num_patch %num_patch is 1000
data_idx = ceil(rand(1,1)*num_data); %num_data is 900
data_fone = train_video{data_idx,layer};
n_hframe = size(data_fone,1); %let's say 26
n_wframe = size(data_fone,2); %let's say 70
hframe = ceil(rand(1,1)*(n_hframe-conf{layer,1}.filt_h+1));
wframe = ceil(rand(1,1)*(n_wframe-conf{layer,1}.filt_w+1));
%patch from frame1
data_fone = reshape(data_fone(hframe:hframe+conf{layer,1}.filt_h-1, ...
wframe:wframe+conf{layer,1}.filt_w-1, :), ...
config{layer,1}.filt_h* conf{layer,1}.filt_w, 1);
%patch from frame2
data_ftwo = reshape(train_video{data_idx+1,layer}(hframe:hframe+conf{layer,1}.filt_ht-1, ...
wframe:wframe+conf{layer,1}.filt_w-1, :), ...
conf{layer,1}.filt_h* conf{layer,1}.filt_w, 1);
%patch from frame3
data_fthree = reshape(train_video{data_idx+2,layer}(hframe:hframe+conf{layer,1}.filt_h-1, ...
wframe:wframe+conf{layer,1}.filt_w-1, :), ...
conf{layer,1}.filt_h* conf{layer,1}.filt_w,1);
%concatenate the patches from three frames
data = [data_fone; data_ftwo; data_fthree]; %675x1
data_video(:,idx) = reshape(data, ...
conf{layer,1}.filt_h * conf{layer,1}.filt_w * conf{layer,1}.in_frames ...
* conf{layer,1}.in_fmaps, 1);
end
when I run this, it says 'Index exceeds matrix dimensions'. And it doesn't produce error at the same index number every time I run it. Why is that? Where is the error here?
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!