Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Storing matrix value

Asked by FIR on 23 May 2012

I have a matrix A =

     6     2     3
     7     9     0
     8     3     4

i have found the minimum value from 1st row,

M=min(A(1,:))

i get value as M=2,now i want to store other values in that column which is 9 and 3 in a variable Z,

so i will have

Z=

9

3

please help

0 Comments

FIR

Tags

Products

No products are associated with this question.

2 Answers

Answer by Andrei Bobrov on 23 May 2012
Accepted answer
[id,id]=min(A(1,:))
Z = A(2:end,id)

0 Comments

Andrei Bobrov
Answer by Wayne King on 23 May 2012
     A = [ 6     2     3
       7     9     0
       8     3     4];
     [minval,I] = min(A(1,:));
     z = A(2:end,I);

1 Comment

FIR on 23 May 2012

Thanks wayne

Wayne King

Contact us