MATLAB talk:Logical Masks

From PrattWiki
Revision as of 01:39, 5 October 2012 by Sjz3 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  • Hello,

My question is: What's the difference between using logical masks in a function file and then calling it in a script file vs. writing an anonymous function for it in the script vs. not using an anonymous function in a script? When would you use each case? Also, can you use an anonymous function in a function file?

—Preceding unsigned comment added by sjz3 (talkcontribs)

  • Hi this is Everett Loving.

When a logical mask is scanning a matrix of numbers, is it possible to ask the mask to check for two conditions? For example, something like:

      variable = (condition && condition) .*value +...
                 (condition) .....

—Preceding unsigned comment added by ejl23 (talkcontribs)

  • Absolutely - see in the GPA example how there are things like
    (70<=Grade & Grade<80) * (2.0)
    
    that has two conditions. Note, though, that masks don't really "scan" so much as they perform all calculations at once. DukeEgr93 01:37, 20 September 2012 (EDT)