How to convert R code to MATLAB?

1 次查看(过去 30 天)
HI. Anyone can help me with this R code? I need to convert in MATLAB code.
S2N <- function(A, C) { # computes robust signal to noise ratio for one gene
x <- split(A, C)
m1 <- mean(x[[1]])
m2 <- mean(x[[2]])
s1 <- ifelse(length(x[[1]]) > 1, sd(x[[1]]), 0)
s2 <- ifelse(length(x[[2]]) > 1, sd(x[[2]]), 0)
s1 <- ifelse(s1 < 0.1*abs(m1), 0.1*abs(m1), s1) # use 10% of the mean if the sd is zero or too low
s2 <- ifelse(s2 < 0.1*abs(m2), 0.1*abs(m2), s2)
s2n <- (m1 - m2)/(s1 + s2 + 0.1)
return(s2n)
}

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by