[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Manipulate financial data - dimensions mismatch
From: |
Carlo de Falco |
Subject: |
Re: Manipulate financial data - dimensions mismatch |
Date: |
Thu, 19 Nov 2009 14:36:48 +0100 |
On 19 Nov 2009, at 14:04, babelproofreader wrote:
Could anyone tell me what this error means?
error: A(I,J,...) = X: dimensions mismatch
error: called from:
error: /home/andrew/Documents/forex_convert/tick_to_min.m at line
105,
column 25
it means what it says: you are trying to assign values to part of an
array, but the
dimensions of the lhs and rhs of the assignment do not match
The code that produces it is
[i,j]=find(fMM>=45 & fMM<50);
min_5_vec(1:length(i),1)=tick_data(min(i):max(i),1); % line 105
to help debug this, you can change it as follows:
[i,j]=find(fMM>=45 & fMM<50);
try
min_5_vec(1:length(i),1)=tick_data(min(i):max(i),1); % line 105
catch
fprintf ("size of lhs:")
size (1:length(i))
fprintf ("size of rhs:")
size (min(i):max(i))
error (lasterr)
end_try_catch
so that you get a mor informative error message
The code checks the "minutes" vector fMM and should extract and
create a new
"min_5_vec" vector containing all tick data that occurred between
the times
HH:45:00 and HH:49:59 for every hour. The thing is this code, which
is part
of a function, appears to fail only on this particular line which I
find
very strange as it has been copied and pasted and only the figures
45 and 50
have been changed, and the other similar parts of the function code
up to
line 105 do not fail. I have visually checked the raw data and can
see no
cause for the nature of the data to be the reason for the failure.
HTH
c.