TA的每日心情 | 开心 2019-11-20 15:05 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
MIT6_094IAP10_lec03
! ]% S4 x5 P4 X0 w: o' P
! _ y9 [% @% c• How long did it take?
( x2 I8 W6 N: y. h5 w- M( l8 ?2 W• Using min with matrices:. m$ q+ b, b7 r% ?' `
» a=[3 7 5;1 9 10; 30 -1 2];
+ W0 |3 a: q5 W( P& B» b=min(a); % returns the min of each column' ]* V/ F5 b+ ^$ @
» m=min(b); % returns min of entire a matrix& n7 {" Q% L/ n V q0 ?8 g
» m=min(min(a)); % same as above; V1 _1 U$ I) h. V7 y
» m=min(a( : )); % makes a a vector, then gets min$ E- s# n1 x! z
• Common mistake:
( P p. q0 V/ X» [m,n]=find(min(a)); % think about what happens
/ R6 c/ @- A, Z: Z6 U K" l: u' U• 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( m" O. D0 j( ?% a* `% C2 }6 I
% M9 V- g& s* t7 k7 U+ c5 M. H1 M" }5 j2 O
6 h8 g v8 L. @
A% r; d+ X; a+ {! n |
|