MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab非整数步索引 (https://www.labfans.com/bbs/showthread.php?t=23470)

poster 2019-12-10 20:41

Matlab非整数步索引
 
所以,我有一个向量:

k = 1:100; 我想从中取19个元素,它们之间的间距大致相等。所以我这样写:

m = k(1:(99/18):end); 这很好用,除了一个小问题:

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 现在,我明白了为什么会这样,但我想摆脱该警告。有没有警告的“正确”方法吗?



[B]回答:[/B]

尝试这个:

floor(linspace(1,100,19))

[url=https://stackoverflow.com/questions/2893596]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:08

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.