TA的每日心情 | 开心 2019-11-20 15:05 |
|---|
签到天数: 2 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
MIT6_094IAP10_lec03
2 b) ~2 r) _% L# U5 D* U4 B* g& s* i& z `) O$ |! W
• How long did it take?
5 Z/ [+ \ k: L2 g• Using min with matrices:' X6 Z0 x1 N% b6 o
» a=[3 7 5;1 9 10; 30 -1 2];
" j: A( E; h0 i! d" d8 F% b; b! y/ u» b=min(a); % returns the min of each column
Q9 [# U" u3 s» m=min(b); % returns min of entire a matrix' q) R) s7 ~+ A! u8 U9 @+ I L
» m=min(min(a)); % same as above
y) @/ x# l1 ]3 w" B/ k* b* b» m=min(a( : )); % makes a a vector, then gets min6 o# z1 e6 J% B: ~! h
• Common mistake:
2 G% j8 B2 y, c' |, W, s» [m,n]=find(min(a)); % think about what happens
7 i! F! e+ G! c- V• 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
. @& j- }* y1 V' }, _/ N( N
$ e3 v9 K: x" C C
1 o0 l, l- |, r6 \9 [
; c0 D% w+ k0 I2 M: s- ^ |
|