How to convert R code to MATLAB?

1 回表示 (過去 30 日間)
noramalina mohd hatta
noramalina mohd hatta 2016 年 3 月 18 日
編集済み: Stephen23 2016 年 3 月 18 日
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 Center および File ExchangeSolver 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