I'm hoping somebody with MATLAB expertise could tell me what the following error message mean and/or how to avoid it.
"??? Colon operands must be in range of the data type."
It occurs at the line:
82: on_ind(z) = find( U_GK(off_ind(z-1):end)>=7 ,1,'first') + off_ind(z-1)-1;
where
U_GK(off_ind(z-1):end)
when singled out seems to be the crux of the problem, with
U_GK [85000x1 double]
off_ind [1x1 uint16] in this iteration
z [1x1 unint16] = 2 in this iteration
What stumps me is that the whole line 82 was copied directly from another function I've worked on, which runs fine with no warning/error in another set of input data with similar Workspace and structure (though U_GK dimension is [8500x1])
Moreover, I've tried the following steps in Command Window in debug mode:
K>> z
ans =
2
K>> off_ind(z-1)
ans =
6011
K>> U_GK(off_ind(z-1))
ans =
5.4571
K>> U_GK(end)
ans =
0.0078
K>> U_GK(6011:end)
ans =
[78990x1 double with 5.4571 as the first element and 0.0078 as the last]
Setting an intermediate variable for off_ind or using eval() didn't solve the problem either.
My coding is definitely far from efficient or elegant, so I'd be grateful for any advice to improve and/or eliminate the error.
Thank you in advance :)
Ramita
> z [1x1 unint16] = 2 in this iteration
The problem is that you are using data of type UINT16.
A 16-bit integer can only represent 2^16 = 65536 different
numbers. If you want to represent larger integer values,
you will have to use some other data type.
Rune
- Ramita
Rune Allnor <all...@tele.ntnu.no> wrote in message <48f8f18f-750f-4a82...@c34g2000yqn.googlegroups.com>...