Re: [問題] 矩陣的問題....已回收
※ 引述《kakar0to (Moonlight Shadow)》之銘言:
: 有沒有只用矩陣的方法(不要用for迴圈)
: 做出 a = [1 -1 1 -1]這種矩陣...
: 因為我目前只想到用for迴圈 一個一個去給值
: 所以想來問問看有沒有更快的方式...謝謝...
你的問題有點不清楚
不太能完全確定你的需求
但如果只是要正負1相間排列的話
只要這樣子寫就可以了
n = 2 ;
a = reshape( [ ones( 1 , n ) ; - ones( 1 , n ) ] , 1 , [] )
如果裡面還有其他需求的話再說
--
Deserves death! I daresay he does. Many that live deserve death. And some die
that deserve life. Can you give that to them? Then be not too eager to deal out
death in the name of justice, fearing for your own safty. Even the wise cannot
see all ends.
Gandalf to Frodo
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.25.235
推
11/25 15:10, , 1F
11/25 15:10, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章