matlab noninteger step indexing
Posted
by rlbond
on Stack Overflow
See other posts from Stack Overflow
or by rlbond
Published on 2010-05-23T21:46:03Z
Indexed on
2010/05/23
21:51 UTC
Read the original article
Hit count: 307
matlab
So, I have a vector:
k = 1:100;
And I want to take 19 elements from it, which are roughly equally-spaced. So I write this:
m = k(1:(99/18):end);
This works great, except for a tiny problem:
Warning: Integer operands are required for colon operator when used as index
m =
1 7 12 18 23 29 34 40 45 51 56 62 67 73 78 84 89 95 100
Now, I understand why this comes up, but I'd like to get rid of that warning. Is there a "right" way to do this without a warning?
© Stack Overflow or respective owner