Stats

Popular Posts

Followers

Mathematica 教學:矩陣元素取代

戴忠淵 於 2014年9月18日星期四 上午11:27 發表
 作者  kobenein (哈哈哈)                                         看板  MATLAB  標題  [問題] 矩陣元素取代 不用迴圈硬幹  時間  Wed Sep 17 20:01:56 2014 ───────────────────────────────────────  X = [0 0 0 1 1 1 1]; Y = [a0 a1;b0 b1;c0 c1];  如何不用迴圈硬幹  得到一個矩陣   [a0 a0 a0 a1 a1 a1 a1;  b0 b0 b0 b1 b1 b1 b1;  c0 c0 c0 c1 c1 c1 c1;];    謝謝

Map[{0,0,0,1,1,1,1}/.{0->#[[1]],1->#[[2]]}&,{{a0,a1},{b0,b1},{c0,c1}}]
Tags: ,

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~