Prev: Anybody?..
Next: And operation for two image
From: Tom Lee on 14 Apr 2010 08:32 Hi, Dear all I program the following procedure: function [row_index,col_index,maxA]= max_array(A) [row,col]=size(A); [AM,IM]=max(A); if row==1 row_index=row; col_index=IM; maxA=AM; else [AMx,J]=max(AM); row_index=IM(J); col_index=J; maxA=AMx; end end why only outputs the row_index, but not the col_index and maxA? Thank you all Tom
From: Steven Lord on 14 Apr 2010 09:40 "Tom Lee" <lee.tom30(a)gmail.com> wrote in message news:68c346ee-c1af-4290-b7ce-1f718f753124(a)12g2000yqi.googlegroups.com... > Hi, Dear all > > I program the following procedure: > > function [row_index,col_index,maxA]= max_array(A) > [row,col]=size(A); > [AM,IM]=max(A); > if row==1 > row_index=row; > col_index=IM; > maxA=AM; > else > [AMx,J]=max(AM); > row_index=IM(J); > col_index=J; > maxA=AMx; > end > end > > why only outputs the row_index, but not the col_index and maxA? Probably because when you called this function, you called it like: outputs = max_array(y); You only asked for one output, so the function only returned one output. If you want all three: [rowInd, colInd, maxValue] = max_array(y) -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: someone on 14 Apr 2010 09:41 Tom Lee <lee.tom30(a)gmail.com> wrote in message <68c346ee-c1af-4290-b7ce-1f718f753124(a)12g2000yqi.googlegroups.com>... > Hi, Dear all > > I program the following procedure: > > function [row_index,col_index,maxA]= max_array(A) > [row,col]=size(A); > [AM,IM]=max(A); > if row==1 > row_index=row; > col_index=IM; > maxA=AM; > else > [AMx,J]=max(AM); > row_index=IM(J); > col_index=J; > maxA=AMx; > end > end > > why only outputs the row_index, but not the col_index and maxA? > > Thank you all > Tom How do you call the function? if you want all 3 oupts returned, you need something like: [a,b,c]= max_array(A)
From: Tom Lee on 14 Apr 2010 09:49 On Apr 14, 3:41 pm, "someone" <some...(a)somewhere.net> wrote: > Tom Lee <lee.to...(a)gmail.com> wrote in message <68c346ee-c1af-4290-b7ce-1f718f753...(a)12g2000yqi.googlegroups.com>... > > Hi, Dear all > > > I program the following procedure: > > > function [row_index,col_index,maxA]= max_array(A) > > [row,col]=size(A); > > [AM,IM]=max(A); > > if row==1 > > row_index=row; > > col_index=IM; > > maxA=AM; > > else > > [AMx,J]=max(AM); > > row_index=IM(J); > > col_index=J; > > maxA=AMx; > > end > > end > > > why only outputs the row_index, but not the col_index and maxA? > > > Thank you all > > Tom > > How do you call the function? > if you want all 3 oupts returned, you need something like: > > [a,b,c]= max_array(A)- Hide quoted text - > > - Show quoted text - my godness, of course. Thank you all very much!
|
Pages: 1 Prev: Anybody?.. Next: And operation for two image |