MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   赋值 (https://www.labfans.com/bbs/showthread.php?t=6676)

linden 2009-03-05 22:24

赋值
 
x=[1 2 3 4 5 6 7 8 9 4 5 6 3 4]现在想把x中一般数(即7个数)赋给y,并且这7个数是互相间隔的7个数。即把第1,3,5,7,9,11,13或者把2,4,6,8,10,12,14赋给y,怎么实现?

slgu 2009-03-05 23:50

回复: 赋值
 
y=x(mod(x,2)==0)
or
y=x(mod(x,2)==1)


所有时间均为北京时间。现在的时间是 05:10

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