convert_matlab_raster_data: Convert raster data in MATLAB to R

Description Usage Arguments Examples

View source: R/convert_matlab_raster_data.R

Description

If one already has raster data created in MATLAB (.mat files), this function can be used to convert it to an R format (.rda files) that can be used with the NDTr.

Usage

1
2
3
4
5
6
7
8
convert_matlab_raster_data(
  matlab_raster_dir_name,
  r_raster_dir_name = NULL,
  start_ind = NULL,
  end_ind = NULL,
  zero_time_bin = NULL,
  files_contain = ""
)

Arguments

matlab_raster_dir_name

A character string specifying the path to a directory that contains raster data in MATLAB .mat files.

r_raster_dir_name

A character string specifying the path to a directory where the converted raster data in R .rda files will be saved. If this is not specified then the saved directory will have the same name as the matlab directory with _rda appended to the end of the directory name.

start_ind

A number specifying the start index for the data to be converted if one wants to convert the data from a shorter time window than the original MATLAB raster data. The default (NULL value) is to use all the data, i.e., start at the beginning with start_ind = 1.

end_ind

A number specifying the end index for the data to be converted if one wants to convert the data from a shorter time window than the original MATLAB raster data. The default (NULL value) is to use all the data, i.e., end value is the last time point.

zero_time_bin

A number specifying the time bin that should be marked as time 0. The default (NULL value) is to use the first bin as time 1.

files_contain

A string specifying that only a subset of the MATLAB raster data should be converted based on .mat files that contain this string.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
matlab_raster_dir_name <- file.path(
  system.file("extdata", package = "NDTr"),
  "Zhang_Desimone_7object_raster_data_small_mat"
)

# create temporary directory to hold converted data
r_raster_dir_name <- file.path("test_convert_matlab_raster_data", "")
r_raster_dir_name <- convert_matlab_raster_data(matlab_raster_dir_name,
  r_raster_dir_name,
  files_contain = "bp1001spk"
)

emeyers/NDTr documentation built on Aug. 8, 2020, 3:41 p.m.