z*****n 发帖数: 7639 | 1 【 以下文字转载自 EE 讨论区 】
发信人: zhaoyun (好德如好色), 信区: EE
标 题: A matlab problem
发信站: BBS 未名空间站 (Fri Jun 12 10:18:58 2009, 美东)
^*I have two vectors:
a = [1 1 1 2 3 4 4];
b = [0 0 0 1 0 2 2];
how to compress a and b so that unique a and their corresponding b
values are held? I am trying to solve it without a loop. | N**D 发帖数: 10322 | 2 easy
【在 z*****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 【 以下文字转载自 EE 讨论区 】 : 发信人: zhaoyun (好德如好色), 信区: EE : 标 题: A matlab problem : 发信站: BBS 未名空间站 (Fri Jun 12 10:18:58 2009, 美东) : ^*I have two vectors: : a = [1 1 1 2 3 4 4]; : b = [0 0 0 1 0 2 2]; : how to compress a and b so that unique a and their corresponding b : values are held? I am trying to solve it without a loop.
| z*****n 发帖数: 7639 | 3 thanks. It indeed is. I didn't know unique() can
return that index also.
【在 N**D 的大作中提到】![](/moin_static193/solenoid/img/up.png) : easy
|
|