Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Modify cells meeting some criteria

Status
Not open for further replies.

mbudka

Computer
Feb 24, 2008
2
Is there a way to set all entries of the matrix which meet a given criteria to an arbitrary value?
I've got a distance matrix and want to set all cells with values greater than some threshold to NaN for graphing purposes. What I do now is a double loop but is there any function or trick which can do it for me?
 
Replies continue below

Recommended for you

Try the if function.

Two ways

1 - embedded with your normal formula:
=+if(NormalFormula<threshhold,NormalFormula,1E99)

2 - in a different sheet, referring to a cell in the original sheet that contains the formula:

i.e. in sheet 2 cell C3
=+IF(sheet1!C3<threshhold,sheet1!C3,1E99)

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Sorry, I didn't make myself clear - I'm talking about a matrxi in Matlab. But thanks anyway :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor