how do i find the 4 element in a matrix

4 ビュー (過去 30 日間)
lowcalorie
lowcalorie 2012 年 2 月 8 日
i need help on writing a script that finds the 4 element in a matrix meaning i need the element in the first row in the fourth column
I am required to use the find() function if that helps

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 2 月 8 日
eg:
A = randi(45,5,4)
out = A(1,4)
OR
i1 = reshape(1:numel(A),size(A,2),[]).'
out = A(find(i1 == 4))
or
out = A(i1 == 4)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by