Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我意识到我可以通过循环来做到这一点,但想知道是否有一些更简单的方法来做到这一点。
只是减去它们?
>> foo = round(20*rand(6,2)) # generate a random matrix with 2 columns foo = 13 9 6 18 0 11 13 14 17 4 10 3 >> foo(:,1) - foo(:,2) # first column minus second column ans = 4 -12 -11 -1 13 7