[Scilab-users] applying a function to each element

Samuel Gougeon sgougeon at free.fr
Wed May 10 23:08:02 CEST 2017


Le 10/05/2017 à 21:36, Erhy a écrit :
> in this special task it is a good practice.
> Generally I wished to have a similar notation as in C  or java (logical) ? a
> : b
> Is there a built in function to have such conditionals ?
Example:

--> format(6)
--> a = rand(3,4)
  a  =
    0.362   0.483   0.502   0.633
    0.292   0.332   0.437   0.405
    0.566   0.594   0.269   0.918

--> c = a< 0.5
  c  =
   T T F F
   T T T T
   F F T F

--> a(c) = 0
  a  =
    0.      0.      0.502   0.633
    0.      0.      0.      0.
    0.566   0.594   0.      0.918





More information about the users mailing list