Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Find Minimum Values of Matrix without MIN or For loops Date: Sun, 1 May 2011 02:39:04 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 29 Message-ID: <ipih48$enm$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-04-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1304217544 15094 172.30.248.35 (1 May 2011 02:39:04 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 1 May 2011 02:39:04 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2677270 Xref: news.mathworks.com comp.soft-sys.matlab:724632 I am reviewing for a test and my teacher loves to ask us questions that require the removal of explicit loops (FOR and WHILE) and use implicit (Array Operations) instead. For example instead of for n=1:100 b=sin(n); end b instead use n=1:100; b=sin(n); b so the function we are to convert is as follows A is an arbitrary predifined Matrix clear,clc for m=1:length(A(1,:)); S(m)=A(1,m); for k=2:length(A(:,1)); if(S(m)>A(k,m)) S(m)=A(k,m); end end end S Where S is a vector with the minimum value of each column. I know this could be solved with Min(A), but that is not what is being ask. How would I use vectorization to make the same above operation to work?