Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how to recognize if column is greater or row????????

1 回表示 (過去 30 日間)
Ayesha Punjabi
Ayesha Punjabi 2019 年 6 月 4 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
  • winner = [2;3;6]
  • a = 8 8
  • 12 4
  • 4 12
  • 8 8
  • 8 8
  • 4 12
  • select = a(winner(1),:)
  • select = 12 4 <----- output
  • large = max(select)
  • final(1) = 1 if select was a column found greater
  • or
  • final(1) = 0 <---- if select was a row found greater
I am stuck at writing a code line for final(1) variable. I am not sure how to recognize whether it was a row or a column. Because if in this case 12 is second row first column which is highest. I want to display logical 1 because it was a column that was present in large variable. but if it was a row value than final(1) should be 0
I would really appreciate someone's help with this

回答 (1 件)

madhan ravi
madhan ravi 2019 年 6 月 4 日
if output(1) > output(2)
disp('Row is greater than column')
elseif output(1) < output(2)
disp(' Column is greater than Row')
else output(1) == output(2)
disp(' Column equals Row')
end
help ndims

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by