How to input a position in a matrix?

I am trying to write a function that takes an input of a m by n matrix and also a 2 element 1D array that represents a position in the given matrix. For example, if I had an array of E=[3 6 3 7 2 5;1 4 2 4 1 4; 7 9 5 6 9 2; 10 8 4 3 10 5] and I wanted to start at position E(3,3) = 5, how would I go about having these both given as a user input?

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2017 年 9 月 6 日
編集済み: KALYAN ACHARJYA 2017 年 9 月 6 日

0 投票

%
A={1 2 3;4 5 6}
% If you want to locate any position suppose
A{2,2} % Go to the particular position>> its go to 5 value element
% Define any position using A{i,j}
%

カテゴリ

ヘルプ センター および File ExchangeData Types についてさらに検索

質問済み:

2017 年 9 月 6 日

編集済み:

2017 年 9 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by