#' Extract beta value in con files
#'
#' \code{extract_fNIRS_beta} can extract the beta value in con file generated by
#' spm_fnirs.
#'
#' @param filename Is a path of single con file you need to extract the beta
#' value in it.
#'
#' @export
#' @author Xiaokai Xia \email{xia@@xiaokai.me}
extract_fNIRS_beta <- function(filename = NA) {
if(is.na(filename)){filename = file.choose()}
if(stringr::str_detect(filename, pattern = "con_") == FALSE){
print("Please choose the 'con_' file which spm_fnirs toolbox generated!")
}
beta_data <- R.matlab::readMat(filename)$S[1,,]$cbeta
return(beta_data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.