TA的每日心情 | 开心 2019-11-20 15:05 |
|---|
签到天数: 2 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
MIT6_094IAP10_lec03( m* q% G4 E) ~! j3 u' B0 s7 L
) h( ~3 M% d$ Y
• How long did it take?
& P1 t4 W0 A3 Y* ]; c; l• Using min with matrices: Z6 Q1 k3 z* E A% P) z/ d% `
» a=[3 7 5;1 9 10; 30 -1 2];
5 B3 t, x9 O4 I! N% R7 R» b=min(a); % returns the min of each column
7 y: d5 ^+ F* G» m=min(b); % returns min of entire a matrix
. M8 Z* ?9 u5 q0 \$ ?» m=min(min(a)); % same as above
. C* T) a* E8 |3 r* B0 k2 ~» m=min(a( : )); % makes a a vector, then gets min& I$ d8 m' s; Y3 G
• Common mistake:
# j! |7 p; E1 t0 w$ r: ^( w» [m,n]=find(min(a)); % think about what happens
( Y8 m. g& Z, T9 R# l! k7 k• How to make and run a function: save the file, then call it from the command window like any other function. No need to 'compile' or make it official in any other way
* W4 q, S6 I1 |# m2 n/ n, ]) Y7 e7 i! [0 J' ~
) x( I3 P) K7 J6 H5 }
?2 W1 c/ }) u) K! J9 x2 y' ?0 K$ \
|
|