I wanna know, how can I get the position of a given value in a matrix
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
As......
A =[1 0 0; 0 1 0]
Tell me, how to find the position of '1' and print the position...
Mind telling me...
Thankyou....
2 Kommentare
Jan
am 17 Feb. 2013
Please note, that "as soon as possible" is not polite, when you ask volunteers to solve your problem.
Akzeptierte Antwort
Azzi Abdelmalek
am 17 Feb. 2013
Bearbeitet: Azzi Abdelmalek
am 17 Feb. 2013
A =[1 0 0; 0 1 0]
idx=find(A==1) % Linear index
% The linear index of your matrix is, in this order
% [1 3 5
% 2 4 6]
%or
A =[1 0 0; 0 1 0] % Matrix indices
[ii,jj]=find(A)
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!