Re: ? grouping data in MatLab

看板Programming作者時間18年前 (2006/07/01 17:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
※ 引述《me1237guy.bbs@bbs.cs.nthu.edu.tw (Ryan)》之銘言: > You may use "vectorization" techniques rather than the traditional for-loop. > For exmaple, suppose your data format is defined as follows: > data = [x(1) y(1) z(1) type; x(2) y(2) z(2) type; ...;x(NoData) y(NoData) z(NoData) type]; > ind = (data(:,4)==1); % find index of type 1 data > data(:,ind); % it represents type 1 data > ind = (data(:,4)==2); % find index of type 2 data > data(:,ind); % it represents type 2 data But what if those processes are sequential? That is, one needs to process 1st element that belongs to type-1, and then 2nd element that belongs to type-1, and so on? Thanks, by Cheng Cosine Jul/01/2k6 NC -- ┌─────KKCITY─────┐ KK免/費/撥/接 bbs.kkcity.com.tw 電話(1):4491999 電話(2):4058-6000 └──From:71.77.83.46 ──┘帳號:kkcity 密碼:kkcity --
文章代碼(AID): #14fa4J00 (Programming)
文章代碼(AID): #14fa4J00 (Programming)