TA的每日心情 | 开心 2019-11-20 15:05 |
|---|
签到天数: 2 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
MIT6_094IAP10_lec03( J, z, E0 s7 d* |5 c
: j3 {' |, Z P$ Y• How long did it take?' K2 R8 k5 ]+ v' A, B
• Using min with matrices:
" I# S% k$ A3 q' ^) M3 ~» a=[3 7 5;1 9 10; 30 -1 2];2 R# b) r! g9 p" i0 `
» b=min(a); % returns the min of each column2 G: B' \5 n' j+ @9 E
» m=min(b); % returns min of entire a matrix8 N: e% e1 l6 y! y- Y
» m=min(min(a)); % same as above
8 Y4 L% [4 @' r, Z- [# y5 r; A1 T» m=min(a( : )); % makes a a vector, then gets min
/ k. |& D7 G1 m5 F# S# p6 E• Common mistake:
( V5 ]) C# |0 j& E4 c! k» [m,n]=find(min(a)); % think about what happens
4 \. E/ W/ n! a# y• 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
0 ~/ r, Z T3 p1 p% z
- O. h- r9 \) t# R, P5 r) w& W2 }! F9 k
* D7 U" |, u' ~+ ~/ m. f
|
|