The code below gives me "Index in position 2 exceeds array bounds (must not exceed 1)." when ever i run.

load Trade
load Midquote
data1=AustriaTrade;
data2=AustriaMquotes;
%{mdq trade ask bid spread volume No_trades};
%data5 = SpainTrade;
mqp= log(data2(:,6));
mqpd = mqp-repmat(mean(mqp,1),length(mqp),1); % demaen data
mqpd= mqpd(:,1:end);
trade= log(data1(:,4));
traded = trade-repmat(mean(trade,1),length(trade),1); % demaen data
traded= traded(:,1:end);
%mqp= (dataalldaily{1,1}); traded(:,266:end)traded=[traded(:,1:264) traded(:,266:end)];
%trade= (dataalldaily{1,2});
%%% Ask and Bid
ask= log(data2(:,5));
ask = ask - repmat(mean(ask,1),length(ask),1); % demaen data
ask= ask(:,1:end);
bid= log(data2(:,4));
bid = bid - repmat(mean(bid,1),length(bid),1); % demaen data
bid= bid(:,1:end);
%end
naset=2;
lag = 10;
rank = 1;
%implag = 50;
ndays = 261;
nstock = 65;
ILST1 = zeros(ndays,nstock);
ILST2 = zeros(ndays,nstock);
ACF=zeros(ndays,nstock);
VOL=zeros(ndays,nstock);
for k=1:ndays-1
for j=1:nstock
data=[mqpd((k-1)*72+1:k*72,j) traded((k-1)*72+1:k*72,j)];% 2 variables
end
end

1 Comment

The error clearly says, you are trying to access more number of elements then present in an array.
By the way you have not specified the line where error is present.

Answers (1)

please this is the code am using. Kindly have a look. Infact there is only one coulmn for trade and and one column for midquotes am using. am using the 6th column of the midquote file and the 4th column of the trade file alone for this work. want to know how i can call the stock and the day in that same column. like what i have in the for loop.

This question is closed.

Tags

Asked:

on 16 Sep 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!