Mar 7, 2008 #1 M mango1986 Newbie level 2 Joined Mar 5, 2008 Messages 2 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,292 Hi, I want to know the matlab code that if H=[ 1 2 3 4 5 6 7 8 9 0] how to get H=[ 3 4 5 6 7 8 9 0] thx!
Hi, I want to know the matlab code that if H=[ 1 2 3 4 5 6 7 8 9 0] how to get H=[ 3 4 5 6 7 8 9 0] thx!
Mar 7, 2008 #2 hmsheng Full Member level 4 Joined Dec 17, 2003 Messages 219 Helped 26 Reputation 52 Reaction score 10 Trophy points 1,298 Location China Activity points 1,556 some code in matlab H=[ 1 2 3 4 5 6 7 8 9 0] >> H1=H(2:5,: ) result: H1=[ 3 4 5 6 7 8 9 0]
Mar 7, 2008 #3 M mango1986 Newbie level 2 Joined Mar 5, 2008 Messages 2 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,292 Re: some code in matlab thx hm sheng! may I ask one more question? if I want to get all subset of H e.g.H[ 1 2 or H[ 1 2 5 6 3 4 7 8 7 8 9 0] 9 0] ......................and so on how can I write the matlab code ? Thx!
Re: some code in matlab thx hm sheng! may I ask one more question? if I want to get all subset of H e.g.H[ 1 2 or H[ 1 2 5 6 3 4 7 8 7 8 9 0] 9 0] ......................and so on how can I write the matlab code ? Thx!
Mar 10, 2008 #4 hmsheng Full Member level 4 Joined Dec 17, 2003 Messages 219 Helped 26 Reputation 52 Reaction score 10 Trophy points 1,298 Location China Activity points 1,556 some code in matlab H = [1 2 3 4 5 6 7 8 9 0]; for i = 1:5 H1 = H; H1(i,: ) = []; HH,:,i) = H1; end result: >> HH HH,:,1) = 3 4 5 6 7 8 9 0 HH,:,2) = 1 2 5 6 7 8 9 0 HH,:,3) = 1 2 3 4 7 8 9 0 HH,:,4) = 1 2 3 4 5 6 9 0 HH,:,5) = 1 2 3 4 5 6 7 8 >> Is this what you want?
some code in matlab H = [1 2 3 4 5 6 7 8 9 0]; for i = 1:5 H1 = H; H1(i,: ) = []; HH,:,i) = H1; end result: >> HH HH,:,1) = 3 4 5 6 7 8 9 0 HH,:,2) = 1 2 5 6 7 8 9 0 HH,:,3) = 1 2 3 4 7 8 9 0 HH,:,4) = 1 2 3 4 5 6 9 0 HH,:,5) = 1 2 3 4 5 6 7 8 >> Is this what you want?