MATLAB Answers

0

Print column value for lowest element in each row of an 2D array

Asked by Koule Pantazopoulos on 30 Aug 2018
Latest activity Commented on by Koule Pantazopoulos on 31 Aug 2018
I have a 2D array 20 X 10 double. Each row has a lowest figure. I am trying to obtain the column index of the minimum element in each row. I do not need the row index, just the column index. An elegant solution was provided ([~,idc] = min(A,[],2). It is able to be displayed. However, I am now having difficulty using fprintf to print the solution.Assistance appreciated

  1 Comment

Your solution helps me format the answer. Thanks you

Sign in to comment.

Products


Release

R2018a

1 Answer

Answer by Greg
on 31 Aug 2018
 Accepted Answer

Why do you want to fprintf the result? Anyway, try:
fprintf('%d\n',idc);

  0 Comments

Sign in to comment.