Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newb Question Printing Matrix Values

Status
Not open for further replies.

ksbdh05

Civil/Environmental
Joined
Apr 4, 2007
Messages
1
Location
US
Hey I'm stumped here. How can I print the location of values in a matrix. For Example if I have a 10x10 matrix with random numbers how can I find and print out the location of every number greater than ten. Thanks
 
You can use "find" and a logical expression. For example,

[row,col] = find(X > 10)

returns indices corresponding to the entries of X that are greater than 10.

xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top