Difference between revisions of "MATLAB talk:Logical Masks"

From PrattWiki
Jump to navigation Jump to search
Line 1: Line 1:
Hi this is Everett Loving.
+
*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:
 
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 +...
 
       variable = (condition && condition) .*value +...
 
                   (condition) .....
 
                   (condition) .....
 +
{{unsigned|ejl23}}
 +
:*Absolutely - see in the GPA example how there are things like <source lang=matlab>
 +
(70<=Grade & Grade<80) * (2.0)
 +
</source>that has two conditions. Note, though, that masks don't really "scan" so much as they perform all calculations at once.  [[User:DukeEgr93|DukeEgr93]] 01:37, 20 September 2012 (EDT)

Revision as of 05:37, 20 September 2012

  • 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)