diff --git a/desktop.ini b/desktop.ini new file mode 100644 index 0000000..0575776 Binary files /dev/null and b/desktop.ini differ diff --git a/scripts/matlab2python/mat2py_listnumpy.m b/scripts/matlab2python/mat2py_listnumpy.m index 692a97b..dd254ac 100644 --- a/scripts/matlab2python/mat2py_listnumpy.m +++ b/scripts/matlab2python/mat2py_listnumpy.m @@ -12,7 +12,7 @@ % Convert MATLAB arrays to NumPy arrays for i = 1:numel(matlab_arrays) - np_array = py.numpy.array(matlab_arrays{i}(:).'); % Convert to column vector and then to NumPy array + np_array = py.numpy.array(matlab_arrays{i}); % Convert to column vector and then to NumPy array py_arrays.append(np_array); end end diff --git a/scripts/save_tsdf_data.m b/scripts/save_tsdf_data.m index 13aa9fb..23e2f81 100644 --- a/scripts/save_tsdf_data.m +++ b/scripts/save_tsdf_data.m @@ -22,7 +22,7 @@ py_dir_path = py.str(mat_dir_path); py_metadata_file_name = py.str(mat_metadata_file_name); - + % Run the python script save_tsdf_data.py and get the 3 outputs [py_succ, ~] = pyrunfile("tsdf_python_interface\save_tsdf_data.py",["Success" "Return_list_metadata" "Return_list_data"], py_list_metadata=py_list_metadata, py_list_data=py_list_data, py_dir_path=py_dir_path, py_metadata_file_name=py_metadata_file_name); diff --git a/scripts/tsdf_python_interface/save_tsdf_data.py b/scripts/tsdf_python_interface/save_tsdf_data.py index 80023d9..ea7a0ff 100644 --- a/scripts/tsdf_python_interface/save_tsdf_data.py +++ b/scripts/tsdf_python_interface/save_tsdf_data.py @@ -26,6 +26,7 @@ for metadata, data in zip(py_list_metadata, py_list_data): metadata = json.loads(metadata) file_name = metadata["file_name"] + print(data.shape) new_metadata = tsdf.write_binary_file(py_dir_path, file_name, data, metadata) py_updated_list_metadata.append(new_metadata) diff --git a/tsdf_values_idx.m b/tsdf_values_idx.m new file mode 100644 index 0000000..d5c241a --- /dev/null +++ b/tsdf_values_idx.m @@ -0,0 +1,10 @@ +function indices = tsdf_values_idx(metadata_list, X, week) + indices = []; + for i = 1:length(metadata_list) + % Use regular expression to match the pattern + expression = sprintf('WatchData\\.(PPG|IMU|EDA|ECG)\\.Week%s\\.raw_segment\\d+_%s\\.bin', num2str(week), X); + if ~isempty(regexp(metadata_list{i}.file_name, expression, 'once')) + indices = [indices, i]; + end + end +end \ No newline at end of file