Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

ifelse.m 362 B

1234567891011121314151617181920
  1. function out = ifelse(a,t,b,c)
  2. % out = ifelse(a,t,b,c)
  3. % For each element of a, return t(a) ? b(a) : c(a)
  4. %
  5. % e.g.
  6. % M = 2:10:1000;
  7. % a = [1 5 NaN 8]
  8. % t = @(x)isnan(x);
  9. % b = @(x)nan;
  10. % c = @(x)M(x)
  11. % out = ifelse(a,t,b,c);
  12. %
  13. out = zeros(size(a));
  14. for tx = 1:numel(a)
  15. if t(a(tx))
  16. out(tx) = b(a(tx));
  17. else
  18. out(tx) = c(a(tx));
  19. end
  20. end